Subsetting a MicroDataFrame doesn't subset weights
Closed this issue · 0 comments
MaxGhenis commented
Example:
d = mdf.MicroDataFrame({"x": [1, 2, 3], "y": [1, 2, 2]}, weights=[4, 5, 6])
d2 = d[d.y > 1]
d2.shape # (2, 2)
d2.weights.shape # (3,)
Among other things, this breaks commands like d[d.y > 1].mean()
with:
TypeError: Axis must be specified when shapes of a and weights differ.
This doesn't affect MicroSeries:
s = mdf.MicroSeries([1, 2, 3], weights=[4, 5, 6])
s2 = s[s > 1]
s2.shape # (2,)
s2.weights.shape # (2,)