-
Book Overview & Buying
-
Table Of Contents
Learning Pandas
By :
Our examination of splitting a pandas objects will be broken into several sections. We will first load data to use in the examples. Then, we will look at creating a grouping based on columns, examining properties of a grouping in the process. Next, will be an examination of accessing the results of the grouping. The last subsection will examine grouping using index labels, instead of content in columns.
pandas' Series and DataFrame objects are split into groups using the .groupby() method. To demonstrate, we will use a variant of the accelerometer sensor data introduced in the previous chapter. This version of the data adds another column (sensor) that can be used to specify multiple sensors:
In [2]: # load the sensors data sensors = pd.read_csv("data/sensors.csv") sensors Out[2]: interval sensor axis reading 0 0 accel Z 0.0 1 0 accel Y 0.5 2 0 accel X 1.0 ...
Change the font size
Change margin width
Change background colour