[Solved] Calculate the min, max and mean windspeeds and standard deviations


Load the data:

df = pd.read_csv('wind_data.csv')

Convert date to datetime and set as the index

df.date = pd.to_datetime(df.date)
df.set_index('date', drop=True, inplace=True)

Create a DateFrame for 1961

df_1961 = df[df.index < pd.to_datetime('1962-01-01')]

Resample for statistical calculations

df_1961.resample('W').mean()
df_1961.resample('W').min()
df_1961.resample('W').max()
df_1961.resample('W').std()

Plot the data for 1961:

fix, axes = plt.subplots(12, 1, figsize=(15, 60), sharex=True)
for name, ax in zip(df_1961.columns, axes):
    ax.plot(df_1961[name], label="Daily")
    ax.plot(df_1961_mean[name], label="Weekly Mean Resample")
    ax.plot(df_1961_min[name], label="Weekly Min")
    ax.plot(df_1961_max[name], label="Weekly Max")
    ax.set_title(name)
    ax.legend()

solved Calculate the min, max and mean windspeeds and standard deviations