99from pandas import Index , isna
1010from pandas .util .testing import assert_almost_equal
1111import pandas .util .testing as tm
12- from pandas ._libs import lib , groupby
12+ from pandas ._libs import lib , groupby , reduction
1313
1414
1515def test_series_grouper ():
@@ -19,7 +19,7 @@ def test_series_grouper():
1919
2020 labels = np .array ([- 1 , - 1 , - 1 , 0 , 0 , 0 , 1 , 1 , 1 , 1 ], dtype = np .int64 )
2121
22- grouper = lib .SeriesGrouper (obj , np .mean , labels , 2 , dummy )
22+ grouper = reduction .SeriesGrouper (obj , np .mean , labels , 2 , dummy )
2323 result , counts = grouper .get_result ()
2424
2525 expected = np .array ([obj [3 :6 ].mean (), obj [6 :].mean ()])
@@ -36,7 +36,7 @@ def test_series_bin_grouper():
3636
3737 bins = np .array ([3 , 6 ])
3838
39- grouper = lib .SeriesBinGrouper (obj , np .mean , bins , dummy )
39+ grouper = reduction .SeriesBinGrouper (obj , np .mean , bins , dummy )
4040 result , counts = grouper .get_result ()
4141
4242 expected = np .array ([obj [:3 ].mean (), obj [3 :6 ].mean (), obj [6 :].mean ()])
@@ -127,26 +127,27 @@ def test_int_index(self):
127127 from pandas .core .series import Series
128128
129129 arr = np .random .randn (100 , 4 )
130- result = lib .reduce (arr , np .sum , labels = Index (np .arange (4 )))
130+ result = reduction .reduce (arr , np .sum , labels = Index (np .arange (4 )))
131131 expected = arr .sum (0 )
132132 assert_almost_equal (result , expected )
133133
134- result = lib .reduce (arr , np .sum , axis = 1 , labels = Index (np .arange (100 )))
134+ result = reduction .reduce (arr , np .sum , axis = 1 ,
135+ labels = Index (np .arange (100 )))
135136 expected = arr .sum (1 )
136137 assert_almost_equal (result , expected )
137138
138139 dummy = Series (0. , index = np .arange (100 ))
139- result = lib .reduce (arr , np .sum , dummy = dummy ,
140- labels = Index (np .arange (4 )))
140+ result = reduction .reduce (arr , np .sum , dummy = dummy ,
141+ labels = Index (np .arange (4 )))
141142 expected = arr .sum (0 )
142143 assert_almost_equal (result , expected )
143144
144145 dummy = Series (0. , index = np .arange (4 ))
145- result = lib .reduce (arr , np .sum , axis = 1 , dummy = dummy ,
146- labels = Index (np .arange (100 )))
146+ result = reduction .reduce (arr , np .sum , axis = 1 , dummy = dummy ,
147+ labels = Index (np .arange (100 )))
147148 expected = arr .sum (1 )
148149 assert_almost_equal (result , expected )
149150
150- result = lib .reduce (arr , np .sum , axis = 1 , dummy = dummy ,
151- labels = Index (np .arange (100 )))
151+ result = reduction .reduce (arr , np .sum , axis = 1 , dummy = dummy ,
152+ labels = Index (np .arange (100 )))
152153 assert_almost_equal (result , expected )
0 commit comments