how to set index pandas

Solutions on MaxInterview for how to set index pandas by the best coders in the world

showing results for - "how to set index pandas"
Maimouna
02 Feb 2019
1# assignment copy
2df = df.set_index('month')
3
4# or inplace
5df.set_index('month', inplace=True)
6
7#      year   sale  month            month  year   sale
8#  0   2012   55    1                1      2012   55
9#  1   2014   40    4       =>       4      2014   40
10#  2   2013   84    7                7      2013   84
11#  3   2014   31    10               10     2014   31