energy.loc['Republic of Korea']
I want to change the value of index from 'Republic of Korea' to 'South Korea'. But the dataframe is too large and it is not possible to change every index value. How do i change only this single value?
energy.loc['Republic of Korea']
I want to change the value of index from 'Republic of Korea' to 'South Korea'. But the dataframe is too large and it is not possible to change every index value. How do i change only this single value?
If you have MultiIndex DataFrame, do this:
Here's another idea based on
set_value
Here's another good one, using replace on the column.
@EdChum's solution looks good. Here's one using rename, which would replace all these values in the index.
Here's an example
You want to do something like this:
Basically, you get the index as a list, change that one element, and the replace the existing index.
Try This