File tree 3 files changed +12
-0
lines changed
3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ Bug fixes
29
29
30
30
- Using ``pd.NA `` with :meth: `DataFrame.to_json ` now correctly outputs a null value instead of an empty object (:issue: `31615 `)
31
31
32
+ **Strings **
33
+
34
+ - Using ``pd.NA `` with :meth: `Series.str.repeat ` now correctly outputs a null value instead of raising error for vector inputs (:issue: `31632 `)
35
+
32
36
.. ---------------------------------------------------------------------------
33
37
34
38
.. _whatsnew_102.contributors :
Original file line number Diff line number Diff line change @@ -778,6 +778,8 @@ def scalar_rep(x):
778
778
else :
779
779
780
780
def rep (x , r ):
781
+ if isinstance (x , libmissing .NAType ):
782
+ return x
781
783
try :
782
784
return bytes .__mul__ (x , r )
783
785
except TypeError :
Original file line number Diff line number Diff line change @@ -1153,6 +1153,12 @@ def test_repeat(self):
1153
1153
assert isinstance (rs , Series )
1154
1154
tm .assert_series_equal (rs , xp )
1155
1155
1156
+ # GH: 31632
1157
+ values = Series (["a" , None ])
1158
+ result = values .str .repeat ([3 , 4 ])
1159
+ exp = Series (["aaa" , None ])
1160
+ tm .assert_series_equal (result , exp )
1161
+
1156
1162
def test_match (self ):
1157
1163
# New match behavior introduced in 0.13
1158
1164
values = Series (["fooBAD__barBAD" , np .nan , "foo" ])
You can’t perform that action at this time.
0 commit comments