pyWBE.reporting
Module Contents
Functions
|
This function takes a pandas DataFrame and returns an HTML table. |
|
This function takes the paths to the plots and tables and creates a DOCX report. |
|
This function takes a time-series data, plots the trend of the data and saves it. |
|
This function calculates the weekly concentration percentage change, plots it and saves it. |
|
This function detects change points in the time-series data, plots it and saves it. |
|
This function detects the seasonality in the time-series data, plots it and saves it. |
|
This function normalizes the time-series data, plots it and saves it. |
|
This function forecasts the time-series data, plots it and saves it. |
|
This function generates a PDF report from the given data. |
- pyWBE.reporting.get_html_table(df: pandas.DataFrame)
This function takes a pandas DataFrame and returns an HTML table.
- Parameters:
df – pandas DataFrame.
: type df: pd.DataFrame.
- Returns:
str.
- pyWBE.reporting.create_doc_report(doc_path: str, time_series_plot: str, trend_plot: str, conc_change_plot: str, change_pt_detect_plot: str, seasonality_plot: str, normalize_plot: str, forecast_plot: str, lead_lag_plot: str, lead_table: pandas.DataFrame, lag_table: pandas.DataFrame)
This function takes the paths to the plots and tables and creates a DOCX report.
- Parameters:
doc_path (str.) – Path to save the DOCX report.
time_series_plot (str.) – Path to the time-series plot.
trend_plot (str.) – Path to the trend plot.
conc_change_plot (str.) – Path to the concentration change plot.
change_pt_detect_plot (str.) – Path to the change point detection plot.
seasonality_plot (str.) – Path to the seasonality plot.
normalize_plot (str.) – Path to the normalized plot.
forecast_plot (str.) – Path to the forecast plot.
lead_lag_plot (str.) – Path to the lead-lag plot.
lead_table (pd.DataFrame.) – Lead correlations table.
lag_table (pd.DataFrame.) – Lag correlations table.
- pyWBE.reporting.plot_trends(data: pandas.Series, trend_plot_pth: str)
This function takes a time-series data, plots the trend of the data and saves it.
- Parameters:
data (pd.Series.) – Time-series data.
trend_plot_pth (str.) – Path to save the trend plot.
- pyWBE.reporting.plot_conc_change(data: pandas.Series, conc_change_plot_pth: str)
This function calculates the weekly concentration percentage change, plots it and saves it.
- Parameters:
data (pd.Series.) – Time-series data.
conc_change_plot_pth (str.) – Path to save the weekly concentration percentage change plot.
- pyWBE.reporting.plot_change_pt_detect(data: pandas.Series, change_pt_detect_plot_pth: str, model: str = 'l2', min_size: int = 28, penalty: int = 1)
This function detects change points in the time-series data, plots it and saves it.
- Parameters:
data (pd.Series.) – Time-series data.
change_pt_detect_plot_pth (str.) – Path to save the change point detection plot.
model (str.) – Change point detection model.
min_size – The minimum separation (time steps) between
two consecutive change points detected by the model.
- Parameters:
penalty (int.) – The penalty to be used in the model.
- pyWBE.reporting.plot_seasonality(data: pandas.Series, seasonality_plot_pth: str, model_type: str = 'additive')
This function detects the seasonality in the time-series data, plots it and saves it.
- Parameters:
data (pd.Series.) – Time-series data.
seasonality_plot_pth (str.) – Path to save the seasonality plot.
model_type (str.) – Seasonality model type.
- pyWBE.reporting.plot_normalize(data: pandas.DataFrame, normalize_plot_pth: str, to_normalize: str, normalize_by: str | int)
This function normalizes the time-series data, plots it and saves it.
- Parameters:
data (pd.DataFrame.) – Time-series data.
normalize_plot_pth (str.) – Path to save the normalized plot.
to_normalize (str.) – Column to normalize.
normalize_by (str.) – Column or integet value to normalize by.
- pyWBE.reporting.plot_forecast(data: pandas.Series, forecast_plot_pth: str, window: pandas.DatetimeIndex)
This function forecasts the time-series data, plots it and saves it.
- Parameters:
data (pd.Series.) – Time-series data.
forecast_plot_pth (str.) – Path to save the forecast plot.
window (pd.DatetimeIndex.) – Forecast window.
- pyWBE.reporting.generate_report_from_data(data_1: pandas.DataFrame, data_2: pandas.Series, value_col: str, normalize_using_col: str, forecast_window: pandas.DatetimeIndex, lead_lag_time_instances: int, lead_lag_max_lag: int, pdf_path: str, time_series_plot_pth: str, trend_plot_pth: str, conc_change_plot_pth: str, change_pt_detect_plot_pth: str, seasonality_plot_pth: str, normalize_plot_pth: str, forecast_plot_pth: str, lead_lag_plot_pth: str, plot_type: str = 'linear', change_pt_model: str = 'l2', change_pt_min_size: int = 28, change_pt_penalty: int = 1, seasonality_model: str = 'additive')
This function generates a PDF report from the given data.
- Parameters:
data_1 (pd.DataFrame.) – Primary time-series data to perform analysis on.
data_2 (pd.Series.) – Secondary time-series data to be used for correlation analysis.
value_col (str.) – Column name indicating values of interest in data_1.
normalize_using_col (str.) – Column name to normalize “values” in data_1 by.
forecast_window (pd.DatetimeIndex.) – Forecast window for the time-series data.
lead_lag_time_instances (int.) – Number of time instances to consider for lead-lag correlation.
lead_lag_max_lag (int.) – Maximum lag to consider for lead-lag correlation.
pdf_path (str.) – Path to save the PDF report.
time_series_plot_pth (str.) – Path to save the time-series plot.
trend_plot_pth (str.) – Path to save the trend plot.
conc_change_plot_pth (str.) – Path to save the concentration change plot.
change_pt_detect_plot_pth (str.) – Path to save the change point detection plot.
seasonality_plot_pth (str.) – Path to save the seasonality plot.
normalize_plot_pth (str.) – Path to save the normalized plot.
forecast_plot_pth (str.) – Path to save the forecast plot.
lead_lag_plot_pth (str.) – Path to save the lead-lag plot.
plot_type (str.) – Type of plot to be used for time-series data.
change_pt_model (str.) – Change point detection model.
change_pt_min_size – The minimum separation (time steps) between
two consecutive change points detected by the model.
- Parameters:
change_pt_penalty (int.) – The penalty to be used in the model.
seasonality_model (str.) – Seasonality model type.
- Returns:
HTML of generated report.
- Return type:
str.