Why result different between groupby and count? #1989
-
Hi Thanks for make surprise lib. I tested count() function and compare with group by result. I used below data. The other values are all the same, but the last value of each of the last values is output as zero. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is expected, since binby will use regular bins between a min and max, with half open intervals, e.g. [0, 1), ... [5, 6). If you pass in the limits, e.g.:
You get: Does that make sense? |
Beta Was this translation helpful? Give feedback.
This is expected, since binby will use regular bins between a min and max, with half open intervals, e.g. [0, 1), ... [5, 6).
Then the bins is calculated as int(data / (max - min) * shape) (e.g.
6 => int(6 / 6 * 7) = int(7.0) = 7
, which falls out of the last bin, and5 => int(5/7*7) = int(5/6*8) = int(5.8333) = 5
. So no data falls in bin 6.If you pass in the limits, e.g.:
You get:
Does that make sense?