I have below dataframe:
Date group count
0 2015-01-12 Category1 27
1 2015-01-19 Category1 2
2 2015-01-26 Category1 31
3 2015-02-02 Category1 20
4 2015-02-09 Category1 24
5 2015-02-16 Category1 16
6 2015-02-23 Category1 18
7 2015-03-02 Category1 15
8 2015-03-09 Category1 29
9 2015-03-16 Category1 6
10 2015-03-23 Category1 19
11 2015-03-30 Category1 27
12 2015-04-06 Category1 6
13 2015-04-07 Category1 7
14 2015-04-13 Category1 25
15 2015-04-20 Category1 9
I want to plot a simple timeseries using seaborn. Just a line chart of count on the Y-Axis, with Date on the X-axis something like this just for example:
I thought it would be as simple as: sns.tsplot(data=df, time=df['Date'], value=df['count'])
or sns.tsplot(data=df, time='Date', value='count')
and following the tsplot()
documentation I can't quite get this simple line of code. The datatypes seem fine, but what am i missing here?:
#df.dtypes
Date datetime64[ns]
group object
count int64
Side note, does anyone know why tsplot()
is being deprecated for? (beyond the vague definition in the docs)
However note that the answer of @ImportanceOfBeingErnest is more appropriate
I guess
tsplot
is deprecated because people tend to think it would be useful for plotting timeseries - which isn't the case. Of course you may use it, see e.g. this question, but I would recommend simply plotting the data as a line plot: