dataria.CHRON¶
Visualization and aggregation of time-based data.
This module provides functionality to generate rolling time series plots and calendar heatmaps based on a date column. Input data can be provided via a DataFrame or fetched dynamically using a SPARQL query. Outputs include CSV summaries, Matplotlib and Plotly visualizations.
Functions¶
|
Aggregates and visualizes event data based on a date column. |
Module Contents¶
- dataria.CHRON.date_aggregation(df=None, endpoint_url=None, query=None, date_var='date', plot_type='rolling', mode='count', num_var=None, window=7, csv_filename='time_aggregated_data.csv', png_filename='time_plot.png', html_filename='time_render.html')¶
Aggregates and visualizes event data based on a date column.
The function generates either a rolling time series plot or a heatmap grouped by weekday and month. Input data can be passed as a DataFrame or fetched from a SPARQL endpoint. Aggregated data and plots can be saved as CSV, PNG, and HTML files.
- Parameters:
df (pd.DataFrame, optional) – Input data as a DataFrame. Ignored if endpoint_url and query are provided.
endpoint_url (str, optional) – SPARQL endpoint URL.
query (str, optional) – SPARQL query to fetch data.
date_var (str) – Name of the column containing date values (default: ‘date’).
plot_type (str) – Type of plot to generate – either ‘rolling’ or ‘heatmap’.
mode (str) – Aggregation mode – ‘count’, ‘sum’, or ‘mean’.
num_var (str, optional) – Name of the numeric column for ‘sum’ or ‘mean’ mode.
window (int) – Window size in days for rolling aggregation.
csv_filename (str) – File path to save the aggregated data (CSV).
png_filename (str) – File path to save the plot (PNG).
html_filename (str) – File path to save the Plotly plot (HTML).
- Returns:
None