I have a data frame that is purely boolean. I have two columns IsInTime and IsGoodKine.
IsInTime IsGoodKine
0 True True
1 True True
2 True True
3 True False
4 True False
5 True True
6 True True
7 True True
8 True True
9 True True
...
When I called df.dtypes I get "bool" for every column. However, when I call df[IsInTime].value_counts() I get a series back that does not have two entries: I get this,
True 3846372
False 172188
True 6
Why is Pandas splitting in this instance True into two separate value counts? How can I stop this.
I have inspected the data types of the data frame and event tried casting the column as boolean. It still doesn't fix the issue. I.e.,
df["IsInTime"].astype("bool").value_counts() # Doesn't work
Edit: The below also doesn't work for a similar reason,
df.groupby(['IsGoodKine', 'IsInTime']).size()
it returns,
IsGoodKine IsInTime
False False 7633
True 164555
True True 6
False 133369
True 3713003
dtype: int64
Note: I cannot simply "add" the two values together because what I actually want to do is get the number of entires across the two columns with each logical combination (true, true), (true, false), (false, true) and (false, false). But when I call size() or value_counts() I am getting more than 4 logical combinations! Which can't be correct.