-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Open
Labels
Description
Pandas version checks
- I have checked that the issue still exists on the latest versions of the docs on
main
here
Location of the documentation
https://pandas.pydata.org/docs/dev/reference/api/pandas.json_normalize.html
pandas/pandas/io/json/_normalize.py
Lines 270 to 272 in 3d7a44a
record_prefix : str, default None | |
If True, prefix records with dotted (?) path, e.g. foo.bar.field if | |
path to records is ['foo', 'bar']. |
Documentation problem
The description implies record_prefix
is taken as a boolean, but as said above, it's actually a string. There's an example below that shows how it actually behaves:
pandas/pandas/io/json/_normalize.py
Lines 377 to 383 in 3d7a44a
>>> data = {"A": [1, 2]} | |
>>> pd.json_normalize(data, "A", record_prefix="Prefix.") | |
Prefix.0 | |
0 1 | |
1 2 | |
Returns normalized data with columns prefixed with the given string. |
Suggested fix for documentation
I might suggest:
record_prefix : str, default None
If provided, prefix records with this string, e.g. foo.bar.field if record_prefix is 'foo.bar.'.
BTW, I think meta_prefix
also has the same problem, but I don't have an example to test it on.