Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b6ebed0

Browse files
DOC: Update json_normalize docstring and latest whatsnewvX.X.X.rst file.
1 parent 9bf10b1 commit b6ebed0

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

‎doc/source/whatsnew/v2.3.3.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Bug fixes
2424
^^^^^^^^^
2525
- Fix regression in ``~Series.str.contains``, ``~Series.str.match`` and ``~Series.str.fullmatch``
2626
with a compiled regex and custom flags (:issue:`62240`)
27+
- Fixed bug in :func:`pandas.json_normalize` raising ``TypeError`` when non‐string elements were used in ``meta`` with ``record_path``; ``meta`` path elements are now coerced to strings when forming column labels (:issue:`62264`).
2728

2829
.. ---------------------------------------------------------------------------
2930
.. _whatsnew_233.contributors:

‎pandas/io/json/_normalize.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ def json_normalize(
292292
assumed to be an array of records.
293293
meta : list of paths (str or list of str), default None
294294
Fields to use as metadata for each record in resulting table.
295+
Path elements are converted to strings before joining into column labels.
295296
meta_prefix : str, default None
296297
If True, prefix records with dotted path, e.g. foo.bar.field if
297298
meta is ['foo', 'bar'].
@@ -322,6 +323,12 @@ def json_normalize(
322323
DataFrame : Two-dimensional, size-mutable, potentially heterogeneous tabular data.
323324
Series : One-dimensional ndarray with axis labels (including time series).
324325
326+
Notes
327+
-----
328+
Column labels are constructed by joining path elements,
329+
with sep and are always strings after normalization;
330+
non-string elements in meta paths are coerced to strings.
331+
325332
Examples
326333
--------
327334
>>> data = [

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /