File tree 2 files changed +0
-27
lines changed
2 files changed +0
-27
lines changed Original file line number Diff line number Diff line change @@ -4643,14 +4643,3 @@ def _reorder_by_uniques(uniques, labels):
4643
4643
uniques = algos .take_nd (uniques , sorter , allow_fill = False )
4644
4644
4645
4645
return uniques , labels
4646
-
4647
-
4648
- def numpy_groupby (data , labels , axis = 0 ):
4649
- s = np .argsort (labels )
4650
- keys , inv = np .unique (labels , return_inverse = True )
4651
- i = inv .take (s )
4652
- groups_at = np .where (i != np .concatenate (([- 1 ], i [:- 1 ])))[0 ]
4653
- ordered_data = data .take (s , axis = axis )
4654
- group_sums = np .add .reduceat (ordered_data , groups_at , axis = axis )
4655
-
4656
- return group_sums
Original file line number Diff line number Diff line change @@ -3071,22 +3071,6 @@ def test_panel_groupby(self):
3071
3071
agged = grouped .mean ()
3072
3072
self .assert_index_equal (agged .minor_axis , Index ([0 , 1 ]))
3073
3073
3074
- def test_numpy_groupby (self ):
3075
- from pandas .core .groupby import numpy_groupby
3076
-
3077
- data = np .random .randn (100 , 100 )
3078
- labels = np .random .randint (0 , 10 , size = 100 )
3079
-
3080
- df = DataFrame (data )
3081
-
3082
- result = df .groupby (labels ).sum ().values
3083
- expected = numpy_groupby (data , labels )
3084
- assert_almost_equal (result , expected )
3085
-
3086
- result = df .groupby (labels , axis = 1 ).sum ().values
3087
- expected = numpy_groupby (data , labels , axis = 1 )
3088
- assert_almost_equal (result , expected )
3089
-
3090
3074
def test_groupby_2d_malformed (self ):
3091
3075
d = DataFrame (index = lrange (2 ))
3092
3076
d ['group' ] = ['g1' , 'g2' ]
You can’t perform that action at this time.
0 commit comments