I am trying to plot time series data to tell visually if there are any points that stand out as outliers. I am still familiarizing myself with matplotlib
, but I figured from my data set and setup, I would be able to plot my unit variable on the Y axis and Date on the X Axis and see trends on a daily basis. However, it appears that there is some sort of running total aggregation going on as there is almost a perfectly linear line for the plots from the first date to the last. What is off with my configuration that could be causing this?
Here is my data (I am plotting date
and units
):
month date units ler sales
513 May 2019-05-28 811 94 42
514 May 2019-05-29 807 59 28
515 May 2019-05-30 768 68 24
516 May 2019-05-31 675 60 27
Here is my code:
df_t_3_months // Data Set
plt.figure(figsize=(10,8))
plt.subplot(211)
plt.plot_date(df_t_3_months['date'],df_t_3_months['units'],xdate=True)
Here is the resulting plot:
I was expecting a horizontal pattern with peaks and valleys, as one would expect with consistent time series data
尝试plt.plot(df_t_3_months['date'], df_t_3_months['units'].astype(float))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.