generate functionFri, 31 Mar 2023

giving a list "VInd"=[0.95,0.97,0.99,1.01,1.03,1.05] and the dataframe "global_dataframe". Group "global_dataframe" by the column "Volt" with the mean value of columns "NEVs" and "MWhT" in the dataframe "SumDF". Complete the index "Volt" in "SumDF" with the information from "VInd" filling the abscent information in the columns "NEVs" and "MWhT" with the value of 0.

import pandas as pd import numpy as np Volt = [0.95,0.97,0.99,1.01,1.03,1.05] NEVs = [0.95,0.97,0.99,1.01,1.03,1.05] MWhT = [0.95,0.97,0.99,1.01,1.03,1.05] df=pd.DataFrame({'Volt': Volt, 'NEVs': NEVs,'MWhT': MWhT}) Volt = [0.95,0.97,0.99,1.01,1.03,1.05] NEVs = [0.95,0.97,0.99,1.01,1.03,1.05] MWhT = [0.95,0.97,0.99,1.01,1.03,1.05] df=pd.DataFrame({'Volt': Volt, 'NEVs': NEVs,'MWhT': MWhT})

Questions about programming?Chat with your personal AI assistant