python - pandas plotting a group -
python - pandas plotting a group -
i want plot te next info wich count of unique text
element motor 1 thermiek 15 tijd te lang 9 motor 2 thermiek 12 tijd te lang 3 motor 3 thermiek 5 tijd te lang 4 dtype: int64 by_element = data.groupby('element') by_element['alarm tekst'].value_counts().plot(kind='bar')
result of code
how can create plot grouped like:
this should work grouped bar chart similar 1 linked in comment:
gb = df.groupby(['element','alarm tekst']) gb['alarm tekst'].count().unstack().plot(kind = 'bar')
original suggestion aggregated bar:
you should include agg()
function count total values.
data.groupby('element').agg('count').plot(kind = 'bar')
if sec column summed term can utilize agg(numpy.sum)
instead:
import numpy data.groupby('element').agg(numpy.sum).plot(kind = 'bar')
python pandas
Comments
Post a Comment