util/lib/analysis_package/timeseries/__init__.py

27 lines
1.0 KiB
Python

import pandas as pd
def describe_datetime_info(data: pd.Series, datetime_is_numeric: bool = False) -> pd.Series:
"""
if the type of data is str and data dont have date, it will be populated by the
date of today.
@param data: data
@param datetime_is_numeric : bool, default False
Whether to treat datetime dtypes as numeric. This affects statistics
calculated for the column. For DataFrame input, this also
controls whether datetime columns are included by default.
@return: Summary statistics of the Series.
@example: Describing a numeric ``Series``.
>>> s = pd.read_csv()
>>> s.describe()
count 1427132
unique 25111
top 2022-04-26 09:25:00.260000
freq 32994
first 2022-04-26 09:25:00
last 2022-04-26 09:34:46.340000
Name: TradTime, dtype: object
"""
return pd.to_datetime(data).describe(datetime_is_numeric=datetime_is_numeric)