INNER CODE UNIT · Python
_string_variable_summary_table
aeturrell/skimpy · src/skimpy/__init__.py:457
def _string_variable_summary_table(xf: pd.DataFrame) -> pd.DataFrame:
"""Summarise dataframe columns that have string type. (NB not object type).
Args:
xf (pd.DataFrame): Dataframe with columns of only string 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],
"shortest": pd.Series(
dict(
zip(
xf.columns,