Reputation: 143
I have a panda data table that looks something like this:
And it goes on through over a ton of rows. There's something like 30 or 40 different properties that I want to look at individually.
I'm looking to create a histogram for each individual property based on duration. So a histogram for property A, property B, property C, and so on....
I know how to do it for all properties, as seen in my below code:
df['duration'].plot(kind='hist', sharex=False, use_index=False, bins=100)
plt.show()
Any ideas on how I might go about this?
Upvotes: 3
Views: 4609
Reputation: 143
Nevermind, got it!
http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.hist.html
df.groupby('property_name').hist(column='duration')
Upvotes: 2
Reputation: 294218
consider the following dataframe df
df = pd.DataFrame(dict(duration=np.random.rand(1000),
property_name=np.random.choice(list('abc'), 1000)))
Then you can do
df.groupby('property_name').hist(figsize=(10,2))
Upvotes: 2