I have this dataframe
For some reason when I did this all_data = all_data.set_index(['Location+Type']) the name 'Location+Type' is now gone. How do I now set the first column of the dataframe to have the name 'Location+Type'?
By using set_index(['Location+Type']) you no longer have the column Location+Type instead, it is now the index of your dataframe therefore when printing, you are not seeing the name. If you wish to recover Location+Type as a column, then you need to use:
all_data = all_data.reset_index()
This will create a new index, while returning the original index (Location+Type) to a column. As the documentation states:
When we reset the index, the old index is added as a column, and a new sequential index is used:
all_data.index.name = 'Location+Type'helps?set_index, there's a bug somewhere or something is wrong.