8. 使索引有意义
# set_index()给行索引命名
In[83]: movie = pd.read_csv('data/movie.csv')
In[84]: movie.shape
Out[84]: (4916, 28)
In[85]: movie2 = movie.set_index('movie_title')
movie2
Out[85]:
# 通过index_col参数命名
In[86]: pd.read_csv('data/movie.csv', index_col='movie_title')
Out[86]:
更多
# 复原索引
In[87]: movie2.reset_index()