@@ -165,7 +165,9 @@ def date_parser(*date_cols):
165
165
-------
166
166
parsed : Series
167
167
"""
168
- return parsing .try_parse_dates (parsing .concat_date_cols (date_cols ))
168
+ return parsing .try_parse_dates (
169
+ parsing .concat_date_cols (date_cols ), parser = du_parse
170
+ )
169
171
170
172
kwds = {
171
173
"header" : None ,
@@ -2026,3 +2028,31 @@ def test_parse_dates_and_string_dtype(all_parsers):
2026
2028
expected = DataFrame ({"a" : ["1" ], "b" : [Timestamp ("2019-12-31" )]})
2027
2029
expected ["a" ] = expected ["a" ].astype ("string" )
2028
2030
tm .assert_frame_equal (result , expected )
2031
+
2032
+
2033
+ def test_parse_dot_separated_dates (all_parsers ):
2034
+ # https://github.com/pandas-dev/pandas/issues/2586
2035
+ parser = all_parsers
2036
+ data = """a,b
2037
+ 27.03.2003 14:55:00.000,1
2038
+ 03.08.2003 15:20:00.000,2"""
2039
+ if parser .engine == "pyarrow" :
2040
+ expected_index = Index (
2041
+ ["27.03.2003 14:55:00.000" , "03.08.2003 15:20:00.000" ],
2042
+ dtype = "object" ,
2043
+ name = "a" ,
2044
+ )
2045
+ warn = None
2046
+ else :
2047
+ expected_index = DatetimeIndex (
2048
+ ["2003-03-27 14:55:00" , "2003-08-03 15:20:00" ],
2049
+ dtype = "datetime64[ns]" ,
2050
+ name = "a" ,
2051
+ )
2052
+ warn = UserWarning
2053
+ msg = "when dayfirst=False was specified"
2054
+ result = parser .read_csv_check_warnings (
2055
+ warn , msg , StringIO (data ), parse_dates = True , index_col = 0
2056
+ )
2057
+ expected = DataFrame ({"b" : [1 , 2 ]}, index = expected_index )
2058
+ tm .assert_frame_equal (result , expected )
0 commit comments