Notebook
def getbiomass(colname,key,origdf): biomassArray=origdf.loc[(origdf.Key==key)&(origdf['Order:']==colname), ['Biomass(mg/m3)']] biomass=np.nansum(biomassArray) return biomassfor icol in colList: biomassDF[icol]=[getabundance(icol,ikey,df) for ikey in biomassDF['Key']]