File tree 1 file changed +18
-0
lines changed
pandas/tests/indexes/datetimes
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,24 @@ def test_to_datetime_format_YYYYMMDD(self, cache):
101
101
expected = Series (["20121231" , "20141231" , "NaT" ], dtype = "M8[ns]" )
102
102
tm .assert_series_equal (result , expected )
103
103
104
+ @pytest .mark .parametrize (
105
+ "input_s" ,
106
+ [
107
+ # None with Strings
108
+ Series (["19801222" , None , "20010112" ]),
109
+ # None with Integers
110
+ Series ([19801222 , None , 20010112 ])
111
+ ],
112
+ )
113
+ def test_to_datetime_format_YYYYMMDD_with_none (self ,input_s ):
114
+ # GH 30011
115
+ # format='%Y%m%d'
116
+ # with None
117
+ expected = Series ([Timestamp ("19801222" ), Timestamp (None ),Timestamp ("20010112" )])
118
+
119
+ result = pd .to_datetime (input_s , format = "%Y%m%d" )
120
+ tm .assert_series_equal (result , expected )
121
+
104
122
@pytest .mark .parametrize (
105
123
"input_s, expected" ,
106
124
[
You can’t perform that action at this time.
0 commit comments