File tree 3 files changed +17
-3
lines changed
3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -880,7 +880,7 @@ Bug Fixes
880
880
when matching block and manager items, when there's only one block there's no ambiguity (:issue:`7794`)
881
881
- Bug in putting a ``PeriodIndex`` into a ``Series`` would convert to ``int64`` dtype, rather than ``object`` of ``Periods`` (:issue:`7932`)
882
882
- Bug in HDFStore iteration when passing a where (:issue:`8014`)
883
- - Bug in DataFrameGroupby.transform when transforming with a passed non-sorted key (:issue:`8046`)
883
+ - Bug in DataFrameGroupby.transform when transforming with a passed non-sorted key (:issue:`8046`, :issue:`8430` )
884
884
- Bug in repeated timeseries line and area plot may result in ``ValueError`` or incorrect kind (:issue:`7733`)
885
885
- Bug in inference in a MultiIndex with ``datetime.date`` inputs (:issue:`7888`)
886
886
- Bug in ``get`` where an ``IndexError`` would not cause the default value to be returned (:issue:`7725`)
Original file line number Diff line number Diff line change @@ -484,8 +484,7 @@ def _set_result_index_ordered(self, result):
484
484
indices = self .indices
485
485
486
486
# shortcut of we have an already ordered grouper
487
-
488
- if not Index (self .grouper .group_info [0 ]).is_monotonic :
487
+ if not self .grouper .is_monotonic :
489
488
index = Index (np .concatenate ([ indices [v ] for v in self .grouper .result_index ]))
490
489
result .index = index
491
490
result = result .sort_index ()
@@ -1348,6 +1347,11 @@ def groups(self):
1348
1347
to_groupby = Index (to_groupby )
1349
1348
return self .axis .groupby (to_groupby .values )
1350
1349
1350
+ @cache_readonly
1351
+ def is_monotonic (self ):
1352
+ # return if my group orderings are monotonic
1353
+ return Index (self .group_info [0 ]).is_monotonic
1354
+
1351
1355
@cache_readonly
1352
1356
def group_info (self ):
1353
1357
comp_ids , obs_group_ids = self ._get_compressed_labels ()
@@ -1739,6 +1743,11 @@ def indices(self):
1739
1743
i = bin
1740
1744
return indices
1741
1745
1746
+ @cache_readonly
1747
+ def group_info (self ):
1748
+ # for compat
1749
+ return self .bins , self .binlabels , self .ngroups
1750
+
1742
1751
@cache_readonly
1743
1752
def ngroups (self ):
1744
1753
return len (self .binlabels )
Original file line number Diff line number Diff line change @@ -897,6 +897,11 @@ def demean(arr):
897
897
expected = people .groupby (key ).apply (demean ).groupby (key ).mean ()
898
898
assert_frame_equal (result , expected )
899
899
900
+ # GH 8430
901
+ df = tm .makeTimeDataFrame ()
902
+ g = df .groupby (pd .TimeGrouper ('M' ))
903
+ g .transform (lambda x : x - 1 )
904
+
900
905
def test_transform_fast (self ):
901
906
902
907
df = DataFrame ( { 'id' : np .arange ( 100000 ) / 3 ,
You can’t perform that action at this time.
0 commit comments