Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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()
share|improve this question

1 Answer 1

up vote 5 down vote accepted

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()

hist_example

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.