@@ -230,31 +230,19 @@ def test_cumprod_timedelta(self):
230
230
with pytest .raises (TypeError , match = "cumprod not supported for Timedelta" ):
231
231
ser .cumprod ()
232
232
233
- @pytest .mark .parametrize (
234
- "data, skipna, expected_data" ,
235
- [
236
- ([], True , []),
237
- ([], False , []),
238
- (["x" , "z" , "y" ], True , ["x" , "xz" , "xzy" ]),
239
- (["x" , "z" , "y" ], False , ["x" , "xz" , "xzy" ]),
240
- (["x" , pd .NA , "y" ], True , ["x" , "x" , "xy" ]),
241
- (["x" , pd .NA , "y" ], False , ["x" , pd .NA , pd .NA ]),
242
- ([pd .NA , pd .NA , pd .NA ], True , ["" , "" , "" ]),
243
- ([pd .NA , pd .NA , pd .NA ], False , [pd .NA , pd .NA , pd .NA ]),
244
- ],
245
- )
246
- def test_cumsum_pyarrow_strings (
247
- self , pyarrow_string_dtype , data , skipna , expected_data
248
- ):
249
- # https://github.com/pandas-dev/pandas/pull/60633
250
- ser = pd .Series (data , dtype = pyarrow_string_dtype )
251
- expected = pd .Series (expected_data , dtype = pyarrow_string_dtype )
252
- result = ser .cumsum (skipna = skipna )
253
- tm .assert_series_equal (result , expected )
254
-
255
233
@pytest .mark .parametrize (
256
234
"data, op, skipna, expected_data" ,
257
235
[
236
+ ([], "cumsum" , True , []),
237
+ ([], "cumsum" , False , []),
238
+ (["x" , "z" , "y" ], "cumsum" , True , ["x" , "xz" , "xzy" ]),
239
+ (["x" , "z" , "y" ], "cumsum" , False , ["x" , "xz" , "xzy" ]),
240
+ (["x" , pd .NA , "y" ], "cumsum" , True , ["x" , "x" , "xy" ]),
241
+ (["x" , pd .NA , "y" ], "cumsum" , False , ["x" , pd .NA , pd .NA ]),
242
+ ([pd .NA , "x" , "y" ], "cumsum" , True , ["" , "x" , "xy" ]),
243
+ ([pd .NA , "x" , "y" ], "cumsum" , False , [pd .NA , pd .NA , pd .NA ]),
244
+ ([pd .NA , pd .NA , pd .NA ], "cumsum" , True , ["" , "" , "" ]),
245
+ ([pd .NA , pd .NA , pd .NA ], "cumsum" , False , [pd .NA , pd .NA , pd .NA ]),
258
246
([], "cummin" , True , []),
259
247
([], "cummin" , False , []),
260
248
(["y" , "z" , "x" ], "cummin" , True , ["y" , "y" , "x" ]),
@@ -277,13 +265,11 @@ def test_cumsum_pyarrow_strings(
277
265
([pd .NA , pd .NA , pd .NA ], "cummax" , False , [pd .NA , pd .NA , pd .NA ]),
278
266
],
279
267
)
280
- def test_cummin_cummax_pyarrow_strings (
268
+ def test_cum_methods_pyarrow_strings (
281
269
self , pyarrow_string_dtype , data , op , skipna , expected_data
282
270
):
283
271
# https://github.com/pandas-dev/pandas/pull/60633
284
272
ser = pd .Series (data , dtype = pyarrow_string_dtype )
285
- if expected_data is None :
286
- expected_data = ser .dtype .na_value
287
273
method = getattr (ser , op )
288
274
expected = pd .Series (expected_data , dtype = pyarrow_string_dtype )
289
275
result = method (skipna = skipna )
0 commit comments