Skip to content

Commit 0e793a8

Browse files
code sample for pandas-dev#46935
1 parent 876fa63 commit 0e793a8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

bisect/46935.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# BUG: pd.read_json throwing error on bytes input #BUG: pd.read_json throwing error on bytes input #46935
2+
3+
import pandas as pd
4+
5+
print(pd.__version__)
6+
7+
buffer = b'[{"amount":100,"name":"Alice"},{"amount":200,"name":"Bob"},{"amount":300,"name":"Charlie"},{"amount":400,"name":"Dennis"}]'
8+
9+
result = pd.read_json(buffer)
10+
print(result)
11+
12+
expected = pd.DataFrame(
13+
{"amount": [100, 200, 300, 400], "name": ["Alice", "Bob", "Charlie", "Dennis"]}
14+
)
15+
pd.testing.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)