Skip to content

Instantly share code, notes, and snippets.

@databyjp
Created March 31, 2020 12:28
Show Gist options
  • Save databyjp/9eb4d0af2cd92403d95c40dc2cf87d29 to your computer and use it in GitHub Desktop.
Save databyjp/9eb4d0af2cd92403d95c40dc2cf87d29 to your computer and use it in GitHub Desktop.
>>> messy_df.melt(var_list)
Country Name Country Code Indicator Name Indicator Code variable value
0 Aruba ABW Hospital beds (per 1,000 people) SH.MED.BEDS.ZS 1960 NaN
1 Afghanistan AFG Hospital beds (per 1,000 people) SH.MED.BEDS.ZS 1960 0.170627
2 Angola AGO Hospital beds (per 1,000 people) SH.MED.BEDS.ZS 1960 2.061462
3 Albania ALB Hospital beds (per 1,000 people) SH.MED.BEDS.ZS 1960 5.102676
4 Andorra AND Hospital beds (per 1,000 people) SH.MED.BEDS.ZS 1960 NaN
... ... ... ... ... ...
15835 Kosovo XKX Hospital beds (per 1,000 people) SH.MED.BEDS.ZS 2019 NaN
15836 Yemen, Rep. YEM Hospital beds (per 1,000 people) SH.MED.BEDS.ZS 2019 NaN
15837 South Africa ZAF Hospital beds (per 1,000 people) SH.MED.BEDS.ZS 2019 NaN
15838 Zambia ZMB Hospital beds (per 1,000 people) SH.MED.BEDS.ZS 2019 NaN
15839 Zimbabwe ZWE Hospital beds (per 1,000 people) SH.MED.BEDS.ZS 2019 NaN
[15840 rows x 6 columns]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment