bblocks.analysis_tools.get
Functions
|
|
|
Calculate the average of (a) column(s) over a period of time. |
|
Calculate the change in value from a start to and end _data (in #) |
Module Contents
- bblocks.analysis_tools.get.__validate_cols(d: pandas.DataFrame, sdate: str | None, edate: str | None, date_col: str, value_col: str, grouper: list[str] | None) tuple
- bblocks.analysis_tools.get.period_avg(data: pandas.DataFrame, start_date: str | int | None = None, end_date: str | int | None = None, date_column: str = 'date', value_columns: str | list | None = None, group_by: str | list | None = None) pandas.DataFrame
Calculate the average of (a) column(s) over a period of time.
- Parameters:
data – a DataFrame with a date column (datetime or int) and one or more numeric columns
start_date – Optionally, specify the start date of the period
end_date – Optionally, specify the end date of the period
date_column – the name of the date (datetime or int) column
value_columns – one or more columns to calculate the average over
group_by – Optionally, specify which columns to consider for the average
- Returns:
A DataFrame with the average of the specified columns over the specified period
- bblocks.analysis_tools.get.change_from_date(data: pandas.DataFrame, date_column: str, start_date: str | int, end_date: str | int, value_columns: str | list = None, group_by: str | list | None = None, percentage: bool = False) pandas.DataFrame
Calculate the change in value from a start to and end _data (in #)