I'm new to pandas and plotly. And I have a large csv file with two columns, a date column and a column that contains a string of text (event). Each event is a new row.
I need to plot the date on the x-axis, and the y-axis needs to contain how many times a single event occurs on each date.
The file looks like this (just for illustration):
| Date | Event |
| -------- | -------------- |
| 1/1/1017 | event1 |
| 1/1/1017 | event1 |
| 1/1/1017 | event2 |
| 1/1/1017 | event2 |
| 1/1/1017 | event3 |
| 6/8/1018 | event1 |
| 6/8/1018 | event3 |
| 7/8/1018 | event2 |
| 7/8/1018 | event2 |
I've been able to count the number of occurences of each event for every date:
import numpy as np
import pandas as pd
import matplotlib
import cufflinks as cf
import plotly
import plotly.offline as py
import plotly.graph_objs as go
import matplotlib.pyplot as plt
cf.go_offline()
py.init_notebook_mode()
df = pd.read_csv('file.csv')
df.Date = pd.to_datetime(df.Date)
df.Date.sort_values().index
df = df.iloc[df.Date.sort_values().index]
data = df.groupby(["Date","Event"]).size()
All that is left is to plot this dataframe, but I want to plot it just for one event, for example 'event1'. So I want the plot to illustrate how many times 'event1' occured each date. I've tried plotting data itself,
data = df.groupby(["Date","Event"]).size()
data.iplot(kind='bar', xTitle='Year', yTitle='Count', title='Events Per Day')
but since this is a large dataframe, it comes out very messy, so I want to do it just one one event, and see their occurences over the course of time.
