3

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

1 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.