@@ -55,10 +55,12 @@ def test_separator_date_conflict(all_parsers):
55
55
)
56
56
tm .assert_frame_equal (df , expected )
57
57
58
- @pytest .fixtures (all_parsers )
59
- def test_read_csv_with_custom_date_parser (self , all_parsers ):
58
+ def test_read_csv_with_custom_date_parser (self ):
60
59
# GH36111
61
-
60
+ def __custom_date_parser (time ):
61
+ time = time .astype (np .float )
62
+ time = time .astype (np .int ) # convert float seconds to int type
63
+ return pd .to_timedelta (time , unit = 's' )
62
64
testdata = StringIO (
63
65
"""time e n h
64
66
41047.00 -98573.7297 871458.0640 389.0089
@@ -73,7 +75,7 @@ def test_read_csv_with_custom_date_parser(self, all_parsers):
73
75
testdata ,
74
76
delim_whitespace = True ,
75
77
parse_dates = True ,
76
- date_parser = all_parsers ,
78
+ date_parser = __custom_date_parser ,
77
79
index_col = "time" ,
78
80
)
79
81
expected = pd .DataFrame (
@@ -82,8 +84,9 @@ def test_read_csv_with_custom_date_parser(self, all_parsers):
82
84
"n" : [871458.0640 , 871458.0640 , 871458.0642 , 871458.0643 , 871458.0640 ],
83
85
"h" : [389.0089 , 389.0089 , 389.0088 , 389.0088 , 389.0086 ],
84
86
},
85
- index = [41047.00 , 41048.00 , 41049.00 , 41050.00 , 41051.00 ],
87
+ index = [41047 , 41048 , 41049 , 41050 , 41051 ],
86
88
)
89
+ expected = expected .astype (np .int )
87
90
tm .assert_frame_equal (result , expected )
88
91
89
92
0 commit comments