Skip to content

Instantly share code, notes, and snippets.

@parulnith
Last active August 23, 2018 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parulnith/d2a39f5ec32e3f7407e2df704311cc18 to your computer and use it in GitHub Desktop.
Save parulnith/d2a39f5ec32e3f7407e2df704311cc18 to your computer and use it in GitHub Desktop.
# select Life expectancy for females for all countries in 2013
hist_indicator = 'Life expectancy at birth'
hist_year = 2013
mask1 = data['IndicatorName'].str.contains(hist_indicator)
mask2 = data['Year'].isin([hist_year])
# apply our mask
stage = data[mask1 & mask2]
stage.head()
#Creating a data frame with just the country codes and the values we want plotted.
data_to_plot = stage[['CountryCode','Value']]
data_to_plot.head()
# labelling the legend
hist_indicator = stage.iloc[0]['IndicatorName']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment