Skip to content

Commit f91125c

Browse files
added documentation in docstring for the specific case where orient=table and column is a numeric value and not string
1 parent 71291b0 commit f91125c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pandas/core/generic.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,6 +2377,9 @@ def to_json(
23772377
23782378
Describing the data, where data component is like ``orient='records'``.
23792379
2380+
Note that If `orient='table'`, column names must be strings.
2381+
Using numeric column names will raise a `ValueError`.
2382+
23802383
date_format : {{None, 'epoch', 'iso'}}
23812384
Type of date conversion. 'epoch' = epoch milliseconds,
23822385
'iso' = ISO8601. The default depends on the `orient`. For
@@ -2446,6 +2449,10 @@ def to_json(
24462449
This stores the version of `pandas` used in the latest revision of the
24472450
schema.
24482451
2452+
When using ``orient='table'``, column names must be strings due to JSON
2453+
requiring string keys. If column names are numeric (integers or floats),
2454+
a `ValueError` will be raised.
2455+
24492456
Examples
24502457
--------
24512458
>>> from json import loads, dumps

0 commit comments

Comments
 (0)