data_describe.core.time ============================== .. py:module:: data_describe.core.time .. autoapisummary:: data_describe.core.time.plot_time_series data_describe.core.time.stationarity_test data_describe.core.time.plot_autocorrelation data_describe.core.time.adf_test data_describe.core.time.kpss_test data_describe.core.time.figure_layout .. function:: plot_time_series(df, col, decompose=False, model='additive', compute_backend=None, viz_backend=None, **kwargs) Plots time series given a dataframe with datetime index. Statistics are computed using the statsmodels API. :param df: The dataframe with datetime index :param col: Column of interest. Column datatype must be numerical :type col: str or [str] :param decompose: Set as True to decompose the timeseries with moving average. Defaults to False. :param model: Specify seasonal component when decompose is True. Defaults to "additive". :param compute_backend: Select computing backend. Defaults to None (pandas). :param viz_backend: Select visualization backend. Defaults to None (seaborn). :param \*\*kwargs: Keyword arguments :raises ValueError: Invalid input data type. :raises ValueError: ```col``` not a list or string. :returns: The visualization .. function:: stationarity_test(df, col, test='dickey-fuller', regression='c', compute_backend=None, **kwargs) Perform stationarity tests to see if mean and variance are changing over time. Backend uses statsmodel's statsmodels.tsa.stattools.adfuller or statsmodels.tsa.stattools.kpss :param df: The dataframe. Must contain a datetime index :param col: The feature of interest :param test: Choice of stationarity test. "kpss" or "dickey-fuller". Defaults to "dickey-fuller". :param regression: Constant and trend order to include in regression. Choose between 'c','ct','ctt', and 'nc'. Defaults to 'c' :param compute_backend: Select computing backend. Defaults to None (pandas). :param \*\*kwargs: Keyword arguments :raises ValueError: Invalid input data type. :raises ValueError: `col` not found in dataframe. :returns: Pandas dataframe containing the statistics .. function:: plot_autocorrelation(df, col, plot_type='acf', n_lags=40, fft=False, compute_backend=None, viz_backend=None, **kwargs) Correlation estimate using partial autocorrelation or autocorrelation. Statistics are computed using the statsmodels API. :param df: The dataframe with datetime index :param col: The feature of interest :param plot_type: Choose between 'acf' or 'pacf. Defaults to "pacf". :param n_lags: Number of lags to return autocorrelation for. Defaults to 40. :param fft: If True, computes ACF via fourier fast transform (FFT). Defaults to False. :param compute_backend: Select computing backend. Defaults to None (pandas). :param viz_backend: Select visualization backend. Defaults to None (seaborn). :param \*\*kwargs: Keyword arguments :raises ValueError: Invalid input data type. :raises ValueError: `col` not found in dataframe. :returns: The visualization .. function:: adf_test(timeseries, autolag: str = 'AIC', regression: str = 'c', **kwargs) Compute the Augmented Dickey-Fuller (ADF) test for stationarity. Backend uses statsmodels.tsa.stattools.adfuller :param timeseries: The timeseries :param autolag: Method to use when determining the number of lags. Defaults to 'AIC'. Choose between 'AIC', 'BIC', 't-stat', and None :param regression: Constant and trend order to include in regression. Choose between 'c','ct','ctt', and 'nc' :param \*\*kwargs: Keyword arguments for adfuller :returns: Pandas dataframe containing the statistics .. function:: kpss_test(timeseries, regression: str = 'c', nlags: Optional[int] = None, **kwargs) Compute the Kwiatkowski–Phillips–Schmidt–Shin (KPSS) test for stationarity. Backend uses statsmodels.tsa.stattools.kpss :param timeseries: The timeseries :param regression: The null hypothesis for the KPSS test. 'c' : The data is stationary around a constant (default). 'ct' : The data is stationary around a trend. :param nlags: Indicates the number of lags to be used. Defaults to None. :param \*\*kwargs: Keyword arguments for kpss :returns: Pandas dataframe containing the statistics .. function:: figure_layout(title='Time Series', xlabel='Date', ylabel='Variable') Generates the figure layout. :param title: Title of the plot. Defaults to "Time Series". :param xlabel: x-axis label. Defaults to "Date". :param ylabel: y-axis label. Defaults to "Variable". :returns: The plotly layout