Skip to content

Instantly share code, notes, and snippets.

@nakamasato
Created October 5, 2015 17:34
Show Gist options
  • Save nakamasato/019e400c126c3799ccec to your computer and use it in GitHub Desktop.
Save nakamasato/019e400c126c3799ccec to your computer and use it in GitHub Desktop.
PandasのDataFrameをgroupごとにプロットする。 ref: http://qiita.com/gymnstcs/items/0c651566944c64e5efcb
%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import matplotlib
matplotlib.style.use('ggplot')#これでggplotのような画像ができる。
loc_entropy.head()
for key, grp in loc_entropy.head(500).reset_index().groupby('user_id'):
plt.plot(grp['entropy'],label=key)
plt.show()
for key, grp in time_entropy.head(1000).reset_index().groupby('user_id'):
if len(grp['entropy']) != 1:
plt.hist(np.array(grp['entropy']))
plt.show()
time_entropy.head(2000).reset_index().hist('entropy', by='user_id')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment