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

Weekly cost by component #5

Open
betatim opened this issue Apr 11, 2019 · 3 comments
Open

Weekly cost by component #5

betatim opened this issue Apr 11, 2019 · 3 comments

Comments

@betatim
Copy link
Member

betatim commented Apr 11, 2019

Instead of posting screenshots to twitter, I thought I'd store the weekly snippet here :)

categories = data.groupby(['date', 'category', 'line_item']).sum()['cost'].reset_index()
categories = categories.groupby(['date', 'category']).sum().reset_index()

weekly = (categories.replace(np.nan, 0)
          .groupby(['category']).resample("W", on='date').sum().reset_index())


alt.Chart(data=weekly, width=width).mark_line(clip=True).encode(
    x=alt.X('date', axis=alt.Axis(title='Date (weeks)')),
    y=alt.Y('cost',
            axis=alt.Axis(title='Cost (USD)'),
            scale=alt.Scale(domain=(0, 1000))),
    color="category"
)
@choldgraf
Copy link
Member

nice! want to update the notebook? Or leave it in issue form?

@betatim
Copy link
Member Author

betatim commented Apr 12, 2019

I think we should get https://twitter.com/antarcticdesign/status/1116618370319675393 to send us his code (by picture or real code) :)

@choldgraf
Copy link
Member

choldgraf commented Apr 12, 2019

yeah I agree, those are purdy plots :-)

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