Skip to content Skip to sidebar Skip to footer

Set A Column As Column Index Pandas Dataframe

Let's say I have this data set and for analysing the trends between male and female literacy across rural and urban region of every state . I need to set index as Name Which I can

Solution 1:

So what you can do is use a conditional statement to check whether TRU is rural or urban. Then throw that into a data structure- a list would do which would also make it easy to plot. Let me know if you have any questions or need further clarification!

Solution 2:

You can have a look here: Matplotlib bar chart that displays the x values for male and females

Instead of Male and Females, you have: Rural and Urban.

Post a Comment for "Set A Column As Column Index Pandas Dataframe"