Skip to content

Instantly share code, notes, and snippets.

@nkconnor
Last active October 5, 2018 15:26
Show Gist options
  • Save nkconnor/6912f23c37a8b30fef2427240dc87bf4 to your computer and use it in GitHub Desktop.
Save nkconnor/6912f23c37a8b30fef2427240dc87bf4 to your computer and use it in GitHub Desktop.
MEPS respondent expenditure histogram
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
import meps
survey = meps.as_dataframe("h192")
fig, ax = plt.subplots(1, 1, figsize=(9, 4))
fmt = '${x:,.0f}'
tick = mtick.StrMethodFormatter(fmt)
ax.xaxis.set_major_formatter(tick)
plt.xlabel('Total Expenditure in Dollars')
plt.ylabel('Number of Respondents')
survey['TOTEXP16'].hist(log=True, xrot=0., bins=6, rwidth=0.75, align="left")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment