相关知识
本关我们将学习处理Series和DataFrame中的数据的基本手段,我们将会探讨Pandas最为重要的一些功能。
对索引进行排序
Series用sort_index()按索引排序,sort_values()按值排序;
DataFrame也是用sort_index()和sort_values()。
In[73]: obj = Series(range(4), index=['d','a','b','c'])
In[74]: obj.sort_index()
Out[74]:
a 1
b 2
c 3
d 0
dtype: int64
In[78]: frame = DataFrame(np.arange(8).reshape((2,4)),index=['three',