2
2
from numpy import nan
3
3
import pytest
4
4
5
- from pandas ._libs import groupby , lib , reduction
5
+ from pandas ._libs import groupby , lib , reduction as libreduction
6
6
7
7
from pandas .core .dtypes .common import ensure_int64
8
8
@@ -18,7 +18,7 @@ def test_series_grouper():
18
18
19
19
labels = np .array ([- 1 , - 1 , - 1 , 0 , 0 , 0 , 1 , 1 , 1 , 1 ], dtype = np .int64 )
20
20
21
- grouper = reduction .SeriesGrouper (obj , np .mean , labels , 2 , dummy )
21
+ grouper = libreduction .SeriesGrouper (obj , np .mean , labels , 2 , dummy )
22
22
result , counts = grouper .get_result ()
23
23
24
24
expected = np .array ([obj [3 :6 ].mean (), obj [6 :].mean ()])
@@ -34,7 +34,7 @@ def test_series_bin_grouper():
34
34
35
35
bins = np .array ([3 , 6 ])
36
36
37
- grouper = reduction .SeriesBinGrouper (obj , np .mean , bins , dummy )
37
+ grouper = libreduction .SeriesBinGrouper (obj , np .mean , bins , dummy )
38
38
result , counts = grouper .get_result ()
39
39
40
40
expected = np .array ([obj [:3 ].mean (), obj [3 :6 ].mean (), obj [6 :].mean ()])
@@ -120,31 +120,31 @@ class TestMoments:
120
120
class TestReducer :
121
121
def test_int_index (self ):
122
122
arr = np .random .randn (100 , 4 )
123
- result = reduction .compute_reduction (arr , np .sum , labels = Index (np .arange (4 )))
123
+ result = libreduction .compute_reduction (arr , np .sum , labels = Index (np .arange (4 )))
124
124
expected = arr .sum (0 )
125
125
assert_almost_equal (result , expected )
126
126
127
- result = reduction .compute_reduction (
127
+ result = libreduction .compute_reduction (
128
128
arr , np .sum , axis = 1 , labels = Index (np .arange (100 ))
129
129
)
130
130
expected = arr .sum (1 )
131
131
assert_almost_equal (result , expected )
132
132
133
133
dummy = Series (0.0 , index = np .arange (100 ))
134
- result = reduction .compute_reduction (
134
+ result = libreduction .compute_reduction (
135
135
arr , np .sum , dummy = dummy , labels = Index (np .arange (4 ))
136
136
)
137
137
expected = arr .sum (0 )
138
138
assert_almost_equal (result , expected )
139
139
140
140
dummy = Series (0.0 , index = np .arange (4 ))
141
- result = reduction .compute_reduction (
141
+ result = libreduction .compute_reduction (
142
142
arr , np .sum , axis = 1 , dummy = dummy , labels = Index (np .arange (100 ))
143
143
)
144
144
expected = arr .sum (1 )
145
145
assert_almost_equal (result , expected )
146
146
147
- result = reduction .compute_reduction (
147
+ result = libreduction .compute_reduction (
148
148
arr , np .sum , axis = 1 , dummy = dummy , labels = Index (np .arange (100 ))
149
149
)
150
150
assert_almost_equal (result , expected )
0 commit comments