INNER CODE UNIT · Python
_numeric_variable_summary_table
aeturrell/skimpy · src/skimpy/__init__.py:371
def _numeric_variable_summary_table(xf: pd.DataFrame) -> pd.DataFrame:
"""Summarise dataframe columns that have numeric type.
WARNING: this usually rounds to 4 significant figures.
Args:
xf (pd.DataFrame): Dataframe with columns of only numeric types
Returns:
pd.DataFrame: A dataframe of summary statistics, with a number of rows
determined by number of columns of xf
"""
count_nans_vec = xf.isna().sum()
data_dict = {
MISSING_COL: count_nans_vec,
COMPLETE_COL: 100 * count_nans_vec / xf.shape[0],
NUM_COL_MEAN: _round_series(xf.mean(), 4),
"sd": _round_series(xf.std(), 4),
}