bulum.stats.aggregate_stats module

Aggregate annual statistics for timeseries dataframes.

annual_max(df: DataFrame, wy_month=7, allow_part_years=False)

Returns the maximum annual for a daily timeseries dataframe.

Parameters:
  • df (pd.DataFrame) – Dataframe with date as index

  • wy_month (int, optional) – Water year start month. Defaults to 7 (i.e. July).

  • allow_part_years (bool, optional) – Allow part water years or only complete water years. Defaults to False.

Returns:

  • DataFrame – A dataframe with entries the maximum measurement of each year.

  • numpy.nan – If allow_part_years==False and there is not at least one year in the cropped data frame.

annual_mean(df: DataFrame, wy_month=7, allow_part_years=False)

Returns the mean annual for a daily timeseries dataframe.

Parameters:
  • df (pd.DataFrame) – Dataframe with date as index

  • wy_month (int, optional) – Water year start month. Defaults to 7 (i.e. July).

  • allow_part_years (bool, optional) – Allow part water years or only complete water years. Defaults to False.

Returns:

  • DataFrame – A dataframe with entries the mean measurement of each year.

  • numpy.nan – If allow_part_years==False and there is not at least one year in the cropped data frame.

annual_median(df: DataFrame, wy_month=7, allow_part_years=False)

Returns the median annual for a daily timeseries dataframe.

Parameters:
  • df (pd.DataFrame) – Dataframe with date as index

  • wy_month (int, optional) – Water year start month. Defaults to 7 (i.e. July).

  • allow_part_years (bool, optional) – Allow part water years or only complete water years. Defaults to False.

Returns:

  • DataFrame – A dataframe with entries the median measurement of each year.

  • numpy.nan – If allow_part_years==False and there is not at least one year in the cropped data frame.

annual_min(df: DataFrame, wy_month=7, allow_part_years=False)

Returns the minimum annual for a daily timeseries dataframe.

Parameters:
  • df (pd.DataFrame) – Dataframe with date as index

  • wy_month (int, optional) – Water year start month. Defaults to 7 (i.e. July).

  • allow_part_years (bool, optional) – Allow part water years or only complete water years. Defaults to False.

Returns:

  • DataFrame – A dataframe with entries the minimum measurement of each year.

  • numpy.nan – If allow_part_years==False and there is not at least one year in the cropped data frame.

annual_percentile(df: DataFrame, q, wy_month=7, allow_part_years=False)

Returns the annual percentile (q) for a daily timeseries dataframe.

Parameters:
  • df (pd.DataFrame) – Dataframe with date as index

  • wy_month (int, optional) – Water year start month. Defaults to 7 (i.e. July).

  • allow_part_years (bool, optional) – Allow part water years or only complete water years. Defaults to False.

Returns:

  • DataFrame – A dataframe with entries the percentile q of each year.

  • numpy.nan – If allow_part_years==False and there is not at least one year in the cropped data frame.

annual_sum(df: DataFrame, wy_month=7, allow_part_years=False)

Returns the annual sum for a daily timeseries dataframe.

Parameters:
  • df (pd.DataFrame) – Dataframe with date as index

  • wy_month (int, optional) – Water year start month. Defaults to 7 (i.e. July).

  • allow_part_years (bool, optional) – Allow part water years or only complete water years. Defaults to False.

Returns:

  • DataFrame – A dataframe with entries the maximum measurement of each year.

  • numpy.nan – If allow_part_years==False and there is not at least one year in the cropped data frame.