I need to count the number of fields that have a value > 0
I've tried a lot and i don't understand, why everything is so complicated and i can't just use countif or sumif like in the sql. Help me please
I need to count the number of fields that have a value > 0
I've tried a lot and i don't understand, why everything is so complicated and i can't just use countif or sumif like in the sql. Help me please
This is easily done using conditionals in pandas. For example for open_zones_from_stories:
open_zones = df["open_zones_from_stories"] > 0 # returns an array of True/False
open_zones_count = len(df[open_zones]) # returns number of occurences > 0
You can use any conditionals and any aggregate functions like .count(), .mean() or .std().
This is arguably easier than SQL, it's just a matter of knowing the right approach. I suggest going through the basics in the pandas docs.