Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Data Analysis with NumPy and pandas

You're reading from   Hands-On Data Analysis with NumPy and pandas Implement Python packages from data manipulation to processing

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Packt
ISBN-13 9781789530797
Length 168 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Curtis Miller Curtis Miller
Author Profile Icon Curtis Miller
Curtis Miller
Arrow right icon
View More author details
Toc

Hierarchical indexing


We have come a long way, but we're not quite done yet. We need to talk about hierarchical indexing. In this section, we look at hierarchical indices, why they are useful, how they are created, and how they can be used.

So, what are hierarchical indices? They bring additional structure to an index and exist in pandas as MultiIndex class objects, but they are still an index that can be assigned to a series or DataFrame. With a hierarchical index, we think of rows in a DataFrame, or elements in a series, as uniquely identified by combinations of two or more indices. These indices have a hierarchy, and selecting an index at one level will select all elements with that level of the index. We can go on a more theoretical path and claim that when we have a MultiIndex, the dimensionality of the table increases. It behaves, not as a square on which data exists, but as a cube, or at least it could.

A hierarchical index is used when we want additional structure on the index without...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at R$50/month. Cancel anytime