I am trying to get sum, mean and count of a metric
df.groupby(['id', 'pushid']).agg({"sess_length": [ np.sum, np.mean, np.count]})
But I get "module 'numpy' has no attribute 'count'", and I have tried different ways of expressing the count function but can't get it to work. How do I just an aggregate record count together with the other metrics?
len
? Not sure what you mean about different ways of expressing the count function -numpy
certainly doesn't havenp.count
, as you've seen. What is this function expected to do? – Douglasdouglashomenp.size
– Simoneauxsize
will countnan
as a row,count
will excludenan
– Hammerhead