get_date_summary

get_date_summary(idx, engine='pandas')

Returns a summary of the date-related information, including the number of dates, the time zone, the start date, and the end date.

Parameters

Name Type Description Default
idx pd.Series or pd.DateTimeIndex The parameter idx can be either a pandas Series or a pandas DateTimeIndex. It represents the dates or timestamps for which we want to generate a summary. required
engine str The engine parameter is used to specify the engine to use for generating a date summary. It can be either โ€œpandasโ€ or โ€œpolarsโ€. - The default value is โ€œpandasโ€. - When โ€œpolarsโ€, the function will internally use the polars library for generating a date summary. 'pandas'

Returns

Type Description
pd.DataFrame A pandas DataFrame with the following columns: - date_n: The number of dates in the index. - date_tz: The time zone of the dates in the index. - date_start: The first date in the index. - date_end: The last date in the index.

Examples

import pytimetk as tk
import pandas as pd

df = tk.load_dataset('bike_sales_sample', parse_dates = ['order_date'])

tk.get_date_summary(df['order_date'], engine='pandas')

tk.get_date_summary(df['order_date'], engine='polars')
date_n date_tz date_start date_end
0 2466 None 2011-01-07 2011-12-28