Nilo Araujo
Nilo Araujo

Reputation: 815

Plotting discrete groups count in time axis

I have a dataframe like this:

    date          kind  count
    2015-08-31    1     1
    2015-10-31    1     1
    2015-12-31    1     7
    2015-12-31    5     2
    2015-12-31    2     1
    2015-12-31    3     1
    2016-01-31    1     11
    2016-01-31    2     3
    2016-01-31    5     3
    2016-01-31    4     2
    2016-01-31    3     1

The dates were obtained from a TimeGrouper groupby, so all Year x Month combinations are unique per kind.

Id like to produce a factorplot to plot the count per month along a time axis, broken down by kind, similar to this one, where I have the kind instead of deck: Bidimensional Counting using Seaborn from the Seaborn Documentation

Following this question's suggestion, I did this:

sns.factorplot(x='date', y='kind', data=data, kind='bar')

Which raised the error:

TypeError: ufunc add cannot use operands with types dtype('<M8[ns]') and dtype('<M8[ns]')

So, my question is: is it possible to generate all the charts at once using Seaborn? If not, is there a simple way?

Upvotes: 1

Views: 90

Answers (1)

BENY
BENY

Reputation: 323236

Is this what you need ?

sns.factorplot(x='date', y='count', data=data, kind='bar',col='kind')

enter image description here

Upvotes: 1

Related Questions