You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good catch. See #831. This may end up going in the opposite direction you expected though.
Note that the different behavior of t = [0, -0] isn't a bug in StatsBase, it's just that -0 it exactly the same as 0, as the equivalent of -0.0 doesn't exist for Int. In other words, the information is lost even before countmap has the chance to see it.
Likewise, Dict(keys(ct) .+ 1 .=> values(ct)) simply retains the value for the last time the key was seen in (keys(ct) .+ 1 .=> values(ct)) == [1.0 => 1, 1.0 => 1], it doesn't sum counts (as the Dict constructor isn't made to work only with counts but with any kind of data).
will output:
Changing t to Integers
or removing the weights
leads to the expected behaviour:
Now all of this does not seem problematic until you start changing the keys, e.g.
leads to
in the first case, instead of
Therefore I think this is not the intended behaviour.
To be fair this could also be interpreted as a bug in the general Dict routine.
The text was updated successfully, but these errors were encountered: