Reputation: 79
I want to visualize these data:
Data Source : http://pastebin.com/vx9xLtdm
I couldn't group data per days.
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
df = pd.read_csv('sample.csv')
I tried the both
x = df.groupby(lambda x: x.created_date()))
x = df.set_index('date')
For visualization
df.hist(color='k', alpha=0.5, bins=50)
plt.show()
Upvotes: 3
Views: 1243
Reputation: 36224
Here is an example based on your data using the hist method of a pandas.Series
(note that your data is a series and squeeze=True
in read_csv
returns a Series
in this case):
In [16]: s = pd.read_csv('http://pastebin.com/raw.php?i=vx9xLtdm',
....: parse_dates=True, index_col=0, squeeze=True,
....: na_values=-9999)
In [17]: bins = np.linspace(s.min(), s.max(), num=50)
In [18]: axes = s.hist(by=s.index.date, bins=bins, sharex=True, sharey=True)
In [19]: plt.gcf().autofmt_xdate()
In [20]: plt.draw()
Upvotes: 5