This section deals with how you can reshape data. Sometimes, data is stored in what is known as a stacked format. Here is an example of stacked data using the PlantGrowth dataset:
In [344]: plantGrowthRawDF=pd.read_csv('./PlantGrowth.csv') plantGrowthRawDF Out[344]: observation weight group 0 1 4.17 ctrl 1 2 5.58 ctrl 2 3 5.18 ctrl ... 10 1 4.81 trt1 11 2 4.17 trt1 12 3 4.41 trt1 ... 20 1 6.31 trt2 21 2 5.12 trt2 22 3 5.54 trt2
This data consists of results from an experiment that compared the dried weight yields of plants that were obtained under a control (ctrl) and two different treatment conditions (trt1 and trt2). Suppose we wanted to do some analysis on this data by group value. One way to ...