O'Reilly logo

Learning pandas - Second Edition by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unstacking using hierarchical indexes

To demonstrate unstacking with hierarchical indexes, we will revisit the sensor data we saw earlier in the chapter. However, we will add an additional column to the measurement data that represents readings for multiple users and copy data for two users. The following sets up this data:

With this organization in the data, we can do such things as examine all the readings for a specific person using only the index:

We can also get all the readings of all axes and for all users at interval 1 using .xs() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required