File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -848,6 +848,34 @@ def test_parse_dates_arrow_engine(all_parsers):
848848 tm .assert_frame_equal (result , expected )
849849
850850
851+ def test_parse_dates_arrow_dtype_as_index (all_parsers ):
852+ # GH#57930
853+ parser = all_parsers
854+ data = """a,b
855+ 2000-01-01 00:00:00,1
856+ 2000-01-01 00:00:01,1"""
857+
858+ result = parser .read_csv (
859+ StringIO (data ),
860+ parse_dates = ["a" ],
861+ index_col = "a" ,
862+ dtype_backend = "pyarrow" ,
863+ )
864+ expected = pd .Series (
865+ [1 , 1 ],
866+ name = "b" ,
867+ dtype = "int64[pyarrow]" ,
868+ index = pd .Index (
869+ [
870+ Timestamp ("2000-01-01 00:00:00" ),
871+ Timestamp ("2000-01-01 00:00:01" ),
872+ ],
873+ name = "a" ,
874+ ),
875+ ).to_frame ()
876+ tm .assert_frame_equal (result , expected )
877+
878+
851879@xfail_pyarrow # object dtype index
852880def test_from_csv_with_mixed_offsets (all_parsers ):
853881 parser = all_parsers
You can’t perform that action at this time.
0 commit comments