I have a dataframe like such:
Bool Count State
0 0 1 CA
1 1 1 CA
2 1 1 VT
3 0 1 CA
I wanted to group them all such that I get the number of all values of CA that are 0,1, etc, and I applied the following code:
df.groupby(["State","Bool"]).sum()
And it gives me:
Count
State Bool
CA 0 2
1 1
VT 1 1
How do I output this in a JSON format?