text_html_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import numpy as np # linear algebra

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

df = pd.read_csv('/kaggle/input/temp2021/Temp2021.csv', skiprows=[i for i in range(1, 98)], parse_dates=['Var1'], index_col=['Var1'])
df.index.name = 'Date'
df.index = pd.to_datetime(df.index)
df = df.loc['2021-06-01':'2021-09-30']
df = df.replace(0, np.nan)

dict = {'datax_ 1': '1', 'datax_ 2': '2', 'datax_ 3': '3', 'datax_ 4': '4', 'datax_ 5': '5', 'datax_ 6': '6', 'datax_ 7': '7', 'datax_ 8': '8', 'datax_ 9': '9', 'datax_10': '10', 'datax_11': '11', 'datax_12': '12', 'datax_13': '13', 'datax_14': '14', 'datax_15': '15', 'datax_16': '16', 'datax_17': '17', 'datax_18': '18', 'datax_19': '20', 'datax_20': '21', 'datax_21': '23', 'datax_22': '24', 'datax_23': '25', 'datax_24': '26', 'datax_25': '27', 'datax_26': '28', 'datax_27': '29', 'datax_28': '30', 'datax_29': '31', 'datax_30': '32', 'datax_31': '33', 'datax_32': '34', 'datax_33': '35', 'datax_34': '36', 'datax_35': '37', 'datax_36': '38', 'datax_37': '40', 'datax_38': '41', 'datax_39': '42', 'datax_40': '43', 'datax_41': '45', 'datax_42': '46', 'datax_43': '47', 'datax_44': '48', 'datax_45': '49', 'datax_46': '50', 'datax_47': '51', 'datax_48': '52', 'datax_49': '53', 'datax_50': '54', 'datax_51': '55', 'datax_52': '56', 'datax_53': '57', 'datax_54': '58', 'datax_55': '59', 'datax_56': '60'}
df.rename(columns=dict, inplace=True)

rowmean = df.mean(axis=1).copy()

rowmean.groupby(rowmean.index.hour).mean().plot()

def diurnal_cycle(df, station):
    df[station].groupby(df[station].index.hour).mean().plot(label=station, c='r', marker='o', markersize=4)
    rowmean.groupby(rowmean.index.hour).mean().plot(label='All buttons', c='k')

diurnal_cycle(df, '51')
diurnal_cycle(df, '33')
diurnal_cycle(df, '45')
diurnal_cycle(df, '30')
diurnal_cycle(df, '42')
diurnal_cycle(df, '60')
diurnal_cycle(df, '29')

diurnal_cycle(df, '49')
diurnal_cycle(df, '12')
diurnal_cycle(df, '4')
diurnal_cycle(df, '2')
diurnal_cycle(df, '46')
diurnal_cycle(df, '56')

diurnal_cycle(df, '3')
plt.show()
diurnal_cycle(df, '11')
plt.show()
diurnal_cycle(df, '32')
plt.show()
diurnal_cycle(df, '54')
plt.show()
diurnal_cycle(df, '28')
plt.show()
diurnal_cycle(df, '17')
plt.show()