@@ -230,31 +230,19 @@ def test_cumprod_timedelta(self):
230230 with pytest .raises (TypeError , match = "cumprod not supported for Timedelta" ):
231231 ser .cumprod ()
232232
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-
255233 @pytest .mark .parametrize (
256234 "data, op, skipna, expected_data" ,
257235 [
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 ]),
258246 ([], "cummin" , True , []),
259247 ([], "cummin" , False , []),
260248 (["y" , "z" , "x" ], "cummin" , True , ["y" , "y" , "x" ]),
@@ -277,13 +265,11 @@ def test_cumsum_pyarrow_strings(
277265 ([pd .NA , pd .NA , pd .NA ], "cummax" , False , [pd .NA , pd .NA , pd .NA ]),
278266 ],
279267 )
280- def test_cummin_cummax_pyarrow_strings (
268+ def test_cum_methods_pyarrow_strings (
281269 self , pyarrow_string_dtype , data , op , skipna , expected_data
282270 ):
283271 # https://github.com/pandas-dev/pandas/pull/60633
284272 ser = pd .Series (data , dtype = pyarrow_string_dtype )
285- if expected_data is None :
286- expected_data = ser .dtype .na_value
287273 method = getattr (ser , op )
288274 expected = pd .Series (expected_data , dtype = pyarrow_string_dtype )
289275 result = method (skipna = skipna )
0 commit comments