clarite.describe.freq_table

clarite.describe.freq_table(data:pandas.core.frame.DataFrame)

Return the count of each unique value for all binary and categorical variables. Other variables will return a single row with a value of ‘<Non-Categorical Values>’ and the number of non-NA values.

Parameters
data: pd.DataFrame

The DataFrame to be described

Returns
result: pd.DataFrame

DataFrame listing variable, value, and count for each categorical variable

Examples

>>> import clarite
>>> clarite.describe.freq_table(df).head(n=10)
    variable value  count
0                 SDDSRVYR                         2   4872
1                 SDDSRVYR                         1   4191
2                   female                         1   4724
3                   female                         0   4339
4  how_many_years_in_house                         5   2961
5  how_many_years_in_house                         3   1713
6  how_many_years_in_house                         2   1502
7  how_many_years_in_house                         1   1451
8  how_many_years_in_house                         4   1419
9                  LBXPFDO  <Non-Categorical Values>   1032