pandas - Index column names -


How do I get a list of column names in an index?

Example:

  df1 = pd.DataFrame (np.arange (20). Reshape (4,5)), column = list ('abcde')) df1 = Df1.set_index (['a', 'b'], drop = fail) ABDAB 0 1 0 1 2 3 4 5 6 5 6 7 8 9 10 11 10 11 12 13 14 15 16 15 16 17 18 19 Code>  

Is there a way to query df1 to get the index column: "['a', 'b']"?

This is really simple:

  df1.index. Names  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -