pandas resample to get monthly average with time series data

后端 未结 2 430
眼角桃花
眼角桃花 2021-01-28 09:40

I\'m using the time series dataset from tableau (https://community.tableau.com/thread/194200), containing daily furniture sales, and I want to resample to get average monthly sa

2条回答
  •  不知归路
    2021-01-28 10:03

    You can get the average sales per month using a pivot table: Try:

    df['Order_date']=pd.to_datetime(df['Order_date'])
    df['Month']=df['Order_date'].dt.month
    df_pivot=df.pivot_table(columns='Month',aggfunc='mean')
    

提交回复
热议问题