Skip to content

Commit 1fc6467

Browse files
committed
TST: Fixing Series.str.zfill() to behave same as str.zfill() from standard library (pandas-dev#20868)
1 parent 9d1a0d5 commit 1fc6467

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

doc/source/whatsnew/v0.24.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ Other Enhancements
8484
- :meth:`Series.nlargest`, :meth:`Series.nsmallest`, :meth:`DataFrame.nlargest`, and :meth:`DataFrame.nsmallest` now accept the value ``"all"`` for the ``keep`` argument. This keeps all ties for the nth largest/smallest value (:issue:`16818`)
8585
- :class:`IntervalIndex` has gained the :meth:`~IntervalIndex.set_closed` method to change the existing ``closed`` value (:issue:`21670`)
8686
- :func:`~DataFrame.to_csv` and :func:`~DataFrame.to_json` now support ``compression='infer'`` to infer compression based on filename (:issue:`15008`)
87+
- :func:`Series.str.zfill()` now matches with standard string library zfill (:issue:`20868`)
8788
-
8889

8990
.. _whatsnew_0240.api_breaking:

pandas/tests/test_strings.py

+3
Original file line numberDiff line numberDiff line change
@@ -2242,6 +2242,9 @@ def test_zfill(self):
22422242
expected = Series(['00001', np.nan, '00aaa', np.nan, '45678', np.nan])
22432243
tm.assert_series_equal(result, expected)
22442244

2245+
with tm.assert_raises_regex(TypeError, "width must be of integer"):
2246+
values.str.zfill('5')
2247+
22452248
def test_split(self):
22462249
values = Series(['a_b_c', 'c_d_e', NA, 'f_g_h'])
22472250

0 commit comments

Comments
 (0)