Skip to content

Commit 00cf19f

Browse files
authored
TST: add read_json test with date values GH33787 (#42894)
1 parent f73e6c0 commit 00cf19f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pandas/tests/io/json/test_readlines.py

+15
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ def test_read_jsonl():
2626
tm.assert_frame_equal(result, expected)
2727

2828

29+
def test_read_datetime():
30+
# GH33787
31+
df = DataFrame(
32+
[([1, 2], ["2020-03-05", "2020-04-08T09:58:49+00:00"], "hector")],
33+
columns=["accounts", "date", "name"],
34+
)
35+
json_line = df.to_json(lines=True, orient="records")
36+
result = read_json(json_line)
37+
expected = DataFrame(
38+
[[1, "2020-03-05", "hector"], [2, "2020-04-08T09:58:49+00:00", "hector"]],
39+
columns=["accounts", "date", "name"],
40+
)
41+
tm.assert_frame_equal(result, expected)
42+
43+
2944
def test_read_jsonl_unicode_chars():
3045
# GH15132: non-ascii unicode characters
3146
# \u201d == RIGHT DOUBLE QUOTATION MARK

0 commit comments

Comments
 (0)