Skip to content

Commit 71291b0

Browse files
added a test function to test if a valueerror is thrown if a numeric column name is used in to_json
1 parent 10fbdb9 commit 71291b0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/tests/io/json/test_pandas.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,3 +2283,9 @@ def test_large_number():
22832283
)
22842284
expected = Series([9999999999999999])
22852285
tm.assert_series_equal(result, expected)
2286+
2287+
2288+
def test_to_json_table_numeric_column_names():
2289+
df = DataFrame([[1, 2], [3, 4]], columns=[1, 2])
2290+
with pytest.raises(ValueError, match="Column names must be strings"):
2291+
df.to_json(orient="table")

0 commit comments

Comments
 (0)