microdf-python 1.3.2__py3-none-any.whl → 1.3.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- microdf/microseries.py +5 -1
- microdf/tests/test_nullify_weights_index.py +10 -0
- {microdf_python-1.3.2.dist-info → microdf_python-1.3.3.dist-info}/METADATA +1 -1
- {microdf_python-1.3.2.dist-info → microdf_python-1.3.3.dist-info}/RECORD +7 -6
- {microdf_python-1.3.2.dist-info → microdf_python-1.3.3.dist-info}/WHEEL +0 -0
- {microdf_python-1.3.2.dist-info → microdf_python-1.3.3.dist-info}/licenses/LICENSE +0 -0
- {microdf_python-1.3.2.dist-info → microdf_python-1.3.3.dist-info}/top_level.txt +0 -0
microdf/microseries.py
CHANGED
|
@@ -157,7 +157,11 @@ class MicroSeries(pd.Series):
|
|
|
157
157
|
This is useful for comparing weighted and unweighted statistics or when
|
|
158
158
|
you want to temporarily ignore weights.
|
|
159
159
|
"""
|
|
160
|
-
|
|
160
|
+
# Index the ones against self.index: weighted ops are label-aligned
|
|
161
|
+
# (self.multiply(self.weights) in .sum()/.weight()), so a default
|
|
162
|
+
# RangeIndex here silently produces all-NaN and collapses every
|
|
163
|
+
# aggregation to 0 whenever the caller uses a non-default index.
|
|
164
|
+
self.weights = pd.Series(np.ones(len(self)), index=self.index, dtype=float)
|
|
161
165
|
|
|
162
166
|
@vector_function
|
|
163
167
|
def weight(self) -> pd.Series:
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import microdf as mdf
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_nullify_weights_non_default_index():
|
|
5
|
+
"""nullify_weights must align to the index, not a fresh RangeIndex."""
|
|
6
|
+
s = mdf.MicroSeries([1, 2, 3], index=[10, 11, 12], weights=[1, 2, 3])
|
|
7
|
+
s.nullify_weights()
|
|
8
|
+
assert s.sum() == 6
|
|
9
|
+
assert s.mean() == 2
|
|
10
|
+
assert list(s.weights.index) == [10, 11, 12]
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
microdf/__init__.py,sha256=ldRvhE8t4cD7qlxQ5yLndMnWEUYpDw4m-jCDV_psXkY,319
|
|
2
2
|
microdf/microdataframe.py,sha256=X6OB4Cy8_ENyr1tzplYMdbtVY33zvHmrHX1KUpAEiLE,37284
|
|
3
|
-
microdf/microseries.py,sha256=
|
|
3
|
+
microdf/microseries.py,sha256=T2TDgniyw8JF-f412gBaK6RsdwWfT71atm5oM8Iwhj0,33707
|
|
4
4
|
microdf/tests/conftest.py,sha256=u-EMyX1-u_nM-YO0RJYCzYHQDXxUI2WQE6GkyJlErqg,150
|
|
5
5
|
microdf/tests/test_microseries_dataframe.py,sha256=r9S9z2RFgnFZFMsaT72N-zClT6jEL8YxQ_MUPAr3xi8,30969
|
|
6
|
+
microdf/tests/test_nullify_weights_index.py,sha256=kZgzMaZEa_PXbsor2S4E-6VRid3C3rcC9ufk0qa7mgY,341
|
|
6
7
|
microdf/tests/test_pandas3_compatibility.py,sha256=A34Ni_WQ303sSNv-sqv5CGAQp54zj-ZSGAPEBHZslNI,8573
|
|
7
|
-
microdf_python-1.3.
|
|
8
|
-
microdf_python-1.3.
|
|
9
|
-
microdf_python-1.3.
|
|
10
|
-
microdf_python-1.3.
|
|
11
|
-
microdf_python-1.3.
|
|
8
|
+
microdf_python-1.3.3.dist-info/licenses/LICENSE,sha256=uPs-ASYnzlldpf2z8jeRgQFeEH3FLhSuX0rw0OKWoDU,1067
|
|
9
|
+
microdf_python-1.3.3.dist-info/METADATA,sha256=yWZUQTQGmqYZQkp6TMxF8Lkr23nEE2HUH5eksPB2yfs,2307
|
|
10
|
+
microdf_python-1.3.3.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
11
|
+
microdf_python-1.3.3.dist-info/top_level.txt,sha256=T2WFPTygQQMdS3GF8YpZ12DKfMGrspbZ3r7z-e3KfiM,8
|
|
12
|
+
microdf_python-1.3.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|