Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change df.resample("Y").count() to sum? #28

Closed
ericnost opened this issue Jun 4, 2020 · 0 comments
Closed

Change df.resample("Y").count() to sum? #28

ericnost opened this issue Jun 4, 2020 · 0 comments

Comments

@ericnost
Copy link
Member

ericnost commented Jun 4, 2020

@shansen5 One thing I just noticed in the Cross-Program notebook. An error I probably made!

For the charts, we currently do this:

d = program_data.groupby(pd.to_datetime(program_data[program.date_field], format=program.date_format))[[program.date_field]].count() #counting inspections, enforcements, etc. that happened on each date.
d = d.resample("Y").count() # and then we should SUM the count for the entire year. Otherwise we are counting the number of days on which inspections, enforcements, etc. happened.
d.index = d.index.strftime('%Y')
        
ax = d.plot(kind='bar', title = chart_title, figsize=(20, 10), legend=False, fontsize=16)
 ax

But I think d = d.resample("Y").count() should be d = d.resample("Y").sum() We want to sum the number of inspections, enforcements, violations that occurred within the year.

Originally posted by @ericnost in #25 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants