在 pandas 系列上设置 index.names

set index.names on pandas Series

我想将以下多索引设置为 pandas.Series 。目前,我的索引是 [none、none],我该如何更改它们?

Letters         bins
A              (2.212, 15.753]     4
               (15.753, 29.227]    1
B              (2.212, 15.753]     1
C              (2.212, 15.753]     1
               (15.753, 29.227]    3
               (29.227, 42.701]    2
D              (2.212, 15.753]     1
               (56.174, 69.648]    1
E              (56.174, 69.648]    1

我想你的意思是更改 pandas DataFrame 的列名。你可以使用这个,看看它是否有帮助:

df.set_index(['Letters', 'bins'], inplace=True)