简体   繁体   中英

Cross Tabulation for categorical values in Pandas

In below example, frequency of two categorical values are taken together ie'default' and 'housing'-

pd.crosstab(bd['default'],bd['housing'])

housing no yes

default

no 19701 24695

yes 380 435

In the above frequency table, we observe that there are 24695 observations where the value for 'housing' is 'yes' and 'default' is 'no'.This is a huge chunk of the population. There is a smaller chunk of about 435 observations where housing is 'yes' and default is 'yes'as well. Within the observations where default is 'yes', 'housing' is 'yes' for a higher number of observations ie 435 as compared to where housing is 'no' ie 380.

so i found above explanation in one example but i could not understand the table properly.are they also saying that there are 19701 observation for housing where value is 'no'

Can someone please brief me in simple words or other interpretations what are the observation above?

rajarshig, your crosstab table gives you the following information:

Number of cases where housing is no and default is no = 19701

Number of cases where housing is no and default is yes = 380

Number of cases where housing is yes and default is yes = 435

Number of cases where housing is yes and default is no = 24695

Cheers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM