diive.sstats

diive.sstats(s)[source]

Calculate comprehensive time series statistics.

Returns 30 metrics in 11 groups:

TEMPORAL INFORMATION

STARTDATEstr

First timestamp in series (format: YYYY-MM-DD HH:MM)

ENDDATEstr

Last timestamp in series (format: YYYY-MM-DD HH:MM)

PERIODtimedelta

Total time span covered by series

VALUE COUNTS

NOVint

Number of valid (non-missing) observations

MISSINGint

Number of missing (NaN) values

MISSING_PERCfloat (%)

Percentage of missing values

CENTRAL TENDENCY (Location)

MEANfloat

Arithmetic average of all values

MEDIANfloat

Middle value when sorted (50th percentile)

SUMfloat

Total sum of all values (integration over time period)

DISPERSION (Spread) - Basic

SDfloat

Standard deviation - spread around mean

VARfloat

Variance - squared standard deviation

SD/MEANfloat

Ratio of standard deviation to mean (can be negative)

RANGE & BOUNDS

MINfloat

Minimum value in series

MAXfloat

Maximum value in series

DISPERSION (Spread) - Robust

CVfloat

Coefficient of variation (SD / |Mean|) Relative variability, independent of scale. Use for comparing different series.

IQRfloat

Interquartile range (Q3 - Q1) Robust measure resistant to outliers. Represents middle 50% of data.

DISTRIBUTION SHAPE

SKEWNESSfloat

Fisher-Pearson skewness coefficient > 0: right-skewed (tail extends right, most values clustered left) < 0: left-skewed (tail extends left, most values clustered right) ≈ 0: symmetric distribution

KURTOSISfloat

Excess kurtosis (relative to normal distribution) > 0: heavy tails - more extreme values than normal < 0: light tails - fewer extreme values than normal ≈ 0: similar tail weight to normal distribution

TEMPORAL DYNAMICS

MEAN_ABS_CHANGEfloat

Average absolute change between consecutive time steps High values: volatile, rapidly changing series Low values: smooth, stable trends

TREND_SLOPEfloat

Linear regression slope (change per valid record, gaps are skipped) > 0: upward trend < 0: downward trend ≈ 0: stable (flat trend)

ACF_LAG1float

Autocorrelation at lag-1 (correlation with previous time step) Range: [-1, 1] > 0.7: strong temporal dependence (predictable) 0.3-0.7: moderate dependence < 0.3: weak dependence (more random)

QUALITY METRICS

OUTLIER_COUNTint

Number of statistical outliers detected (>3-sigma by default) Helps identify measurement errors or extreme events

OUTLIER_PERCfloat (%)

Percentage of values that are statistical outliers

INTEGRATION

CUMSUMfloat

Total integrated value (sum of all values) For non-negative series: total accumulation For series with pos/neg: net change over period

PERCENTILES (Distribution quantiles)

P01, P05, P25, P75, P95, P99float

1st, 5th, 25th, 75th, 95th, 99th percentiles Define the distribution at key points. P25-P75 range captures middle 50% (similar to IQR).

returns:

Single-column DataFrame with 30 statistics as rows

rtype:

DataFrame

Example

>>> import diive as dv, pandas as pd
>>> idx = pd.date_range('2024-06-01', periods=4, freq='30min')
>>> series = pd.Series([1.2, 1.5, 1.3, 1.8], index=idx, name='TA')
>>> stats = dv.sstats(series)
Parameters:

s (Series)

Return type:

DataFrame