In many applications , Data may be scattered in many files or databases , The form of storage is also not conducive to analysis . This chapter focuses on aggregating 、 Merge 、 Ways to reshape data .
First , I will introduce pandas Hierarchical index of , It is widely used for the above operations . then , I introduced some special data operations in depth . In the 14 Chapter , You can see many applications of these tools .
Hierarchical index (hierarchical indexing) yes pandas An important function of , It allows you to have multiple... On one axis ( More than two ) Index level . To be more abstract , It enables you to process high-dimensional data in low-dimensional form . Let's start with a simple example : Create a Series, And use a list composed of lists or arrays as an index :
In [9]: data = pd.Series(np.random.randn(9)