elphick.mass_composition.utils.pd_utils.weight_average

elphick.mass_composition.utils.pd_utils.weight_average(df, mass_wet='mass_wet', mass_dry='mass_dry')[source]

Weight Average a DataFrame containing mass-composition

Parameters:
  • df (DataFrame) – The pd.DataFrame containing mass-composition. H2O if provided will be ignored. All columns other than the mass_wet and mass_dry are assumed to be additive, that is, dry mass weighting is valid. Assumes composition is in %w/w units.

  • mass_wet (str) – The wet mass column, not optional. Consider solve_mass_moisture prior to this call if needed.

  • mass_dry (str) – The dry mass column, not optional. Consider solve_mass_moisture prior to this call if needed.

Return type:

DataFrame

Returns:

A pd.Series containing the total mass and weight averaged composition.