Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import pandas as pd
  2. from bokeh.io import output_file, show
  3. from bokeh.models import ColumnDataSource
  4. from bokeh.plotting import figure
  5.  
  6. dataframe = pd.read_csv("practise.csv")
  7. print(dataframe.info())
  8. output_file('output_practise.html', title='practise')
  9.  
  10. dataframe["Date"] = pd.to_datetime(dataframe["Date"])
  11.  
  12. dataframe.sort_values(by=['Date'], inplace=True)
  13. dataframe_sum = dataframe.groupby(pd.Grouper(freq='M')).sum()
  14.  
  15. print(dataframe)
  16.  
  17. fig = figure(x_axis_type="datetime")
  18. source_sum = ColumnDataSource(dataframe_sum)
  19. fig.line(x="Date", y="Value",legend="sum",line_color="blue",line_width=3, source=source_sum)
  20.  
  21. show(fig)
  22.  
  23. # change style again
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement