qis.compute_desc_table¶
- qis.compute_desc_table(df, desc_table_type=DescTableType.SHORT, var_format='{:.2f}', annualize_vol=False, is_add_tstat=False, norm_variable_display_type='{:.1f}', **kwargs)[source]¶
descriptive statistics per column, formatted for display.
Transposes the panel: the input is time by ticker, the output is ticker by statistic. Values are returned as formatted strings, not numbers, because this feeds the table renderer directly — use the underlying statistic functions if the numbers are wanted. Columns may contain nans or
pd.NAin nullable numeric dtypes; both are treated as missing, and statistics are computed on the available observations. Observed positive or negative infinity is invalid and raises before statistics are computed. Dated columns without observations remain in the table with formatted missing statistics and do not emit reduction warnings. Statistics whose columns do not meet their minimum sample sizes also remain formatted as missing: sample standard deviation, skewness, and kurtosis require two observations, while the normality p-value requires 20 observations. Finite samples are translated before sample standard deviation and standardized moments are evaluated, preserving their translation-invariant results when the spread is very small relative to the level. Extreme sample spread is additionally scale-normalized so finite periodic results do not become zero, infinity, or missing through intermediate arithmetic. Annualized volatility and the optional t-statistic use that stabilized sample spread without changing the sample mean. A computed spread is infinite only when the periodic or annualized result itself exceeds the finite binary64 range. Positive probabilities divide positive returns by non-missing observations in each column; zero returns are observed and non-positive.- Parameters:
df (DataFrame | Series) – returns panel, index is time and columns are tickers; a Series is treated as one column named after it; repeated DataFrame column labels are retained and calculated independently; observations may be finite or missing but not infinite
desc_table_type (DescTableType) – which set of statistics to report;
DescTableType.NONEreturns the ticker index with no columns; positive-probability modes use each column’s non-missing observation count as the denominator; moment modes retain defined level statistics, report finite zero-spread moments as missing, and stabilize varying finite samples through translation before standardized-moment calculations; the normality p-value is formatted withPerfStat.NORMTEST’s own four-decimal formatvar_format (str) – format applied to the statistics
annualize_vol (bool) – report volatility per annum rather than per period; reduced modes omit the volatility column selected by this convention
is_add_tstat (bool) – add the signed sample mean divided by its standard error; samples with fewer than two observations or non-positive sample volatility remain formatted as missing
norm_variable_display_type (str) – format applied to the t-statistic
- Returns:
table indexed by ticker, one column per statistic, values as strings
- Raises:
TypeError – if
dfis neither pd.DataFrame nor pd.SeriesValueError – if
dfcontains no observations or contains positive or negative infinity
- Return type: