File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
pandas/tests/indexes/datetimes Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,25 @@ 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, expected" ,
106
+ [
107
+ # strings with None
108
+ [
109
+ Series (["19801222" , None , "20010112" ]),
110
+ Series ([Timestamp ("19801222" ), Timestamp (None ), Timestamp ("20010112" )]),
111
+ ],
112
+ # Integers with None
113
+ [
114
+ Series ([19801222 , None , 20010112 ]),
115
+ Series ([Timestamp ("19801222" ), Timestamp (None ), Timestamp ("20010112" )]),
116
+ ],
117
+ ],
118
+ )
119
+ def test_to_datetime_format_YYYYMMDD_with_none (self , input_s , expected ):
120
+ result = pd .to_datetime (input_s , format = "%Y%m%d" )
121
+ tm .assert_series_equal (result , expected )
122
+
104
123
@pytest .mark .parametrize (
105
124
"input_s, expected" ,
106
125
[
You can’t perform that action at this time.
0 commit comments