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

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -