homes_by_state = df_south.groupby(["state"])["property_type"].value_counts()
I want to output only "state" and total number of "property_type"
I tried this code homes_by_state = df_south.groupby(["state"])["property_type"].count()
and it seems to have done the trick. value_counts()
was outputting total for unique values in the column property_type
. See snapshot correct output