Skip to content
Course Notes: Manipulating Time Series Data in Python
  • AI Chat
  • Code
  • Report
  • resample()

    add text here

    # Import and inspect data here
    stocks = pd.read_csv('stocks.csv', parse_dates=['date'], index_col='date')
    print(stocks.info())
    
    # Calculate and plot the monthly averages
    monthly_average = stocks.resample('M').mean()
    monthly_average.plot(subplots=True);
    plt.show();