Created
February 1, 2020 18:32
-
-
Save rchardptrsn/830d0fbe844be59483aed36946fdc65a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Set the Index on Country Name - previously was numeric. | |
| gdp_transpose = gdp.set_index('Country Name') | |
| # Transpose the index and columns | |
| gdp_transpose = gdp_transpose.transpose() | |
| # Reset the index, sets, 'index' as a column | |
| gdp_transpose = gdp_transpose.reset_index() | |
| # Rename the 'index' column to year | |
| gdp_transpose = gdp_transpose.rename(columns={'index':'Year'}) | |
| # Set the DataFrame Index to newly named 'Year' | |
| gdp_transpose = gdp_transpose.set_index('Year') | |
| gdp_transpose.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment