generate functionFri, 31 Mar 2023

read the dataframe "global_dataframe" from csv file "Sum Dat.csv" group by the columns "time" and "Volt" the mean value of the columns "NVEs" and "MWhT", concatenating the interger values of column "time" converted to string and the float values of column "Volt" converted to string

def global_dataframe(): global_dataframe = pd.read_csv('Sum Dat.csv') global_dataframe['Volt'] = global_dataframe['Volt'].astype(float) global_dataframe['NVEs'] = global_dataframe['NVEs'].astype(float) global_dataframe['MWhT'] = global_dataframe['MWhT'].astype(float) global_dataframe['time'] = global_dataframe['time'].astype(int) dat = global_dataframe.groupby(['time', 'Volt']).agg({'NVEs':np.mean, 'MWhT':np.mean}) dat.reset_index(inplace=True) dat['Volt'] = dat['Volt'].astype(str) dat['time'] = dat['time'].astype(str) dat['Volt'] = dat['time'].str.cat(dat['Volt'], sep =" ") dat['V

Questions about programming?Chat with your personal AI assistant