Skip to content

Commit 2028924

Browse files
author
dickreuter
committed
doc changes
1 parent d298588 commit 2028924

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

doc/source/whatsnew/v0.20.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Other enhancements
6262
- ``pd.DataFrame.plot`` now prints a title above each subplot if ``suplots=True`` and ``title`` is a list of strings (:issue:`14753`)
6363
- ``pd.Series.interpolate`` now supports timedelta as an index type with ``method='time'`` (:issue:`6424`)
6464
- ``pandas.io.json.json_normalize`` If meta keys are not always present a new option to set errors="ignore" (:issue:`14583`)
65+
- ``pandas.io.json.json_normalize`` gained the option ``errors='ignore'|raise``; the default is raise and is backward compatible. (:issue:`14583`)
6566

6667

6768
.. _whatsnew_0200.api_breaking:

pandas/io/json.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,8 @@ def json_normalize(data, record_path=None, meta=None,
743743
path to records is ['foo', 'bar']
744744
meta_prefix : string, default None
745745
error: {'raise', 'ignore'}, default 'raise'
746-
* ignore: will ignore keyErrors if keys listed in meta are not always present
746+
* ignore: will ignore KeyError if keys listed in meta are not always present
747+
* raise: will raise KeyError if keys listed in meta are not always present
747748
748749
Returns
749750
-------
@@ -849,9 +850,7 @@ def _recursive_extract(data, path, seen_meta, level=0):
849850
if errors == 'ignore':
850851
meta_val = np.nan
851852
else:
852-
raise \
853-
KeyError(
854-
"Try running with errors='ignore' as key may not always be present: %s", e)
853+
raise KeyError("Try running with errors='ignore' as key %s is not always present.", e)
855854
meta_vals[key].append(meta_val)
856855

857856
records.extend(recs)

pandas/io/tests/json/test_json_norm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def test_nested_flattens(self):
227227

228228

229229
def test_json_normalize_errors(self):
230-
# If meta keys are not always present a new option to set errors='ignore' has been implemented (:issue:`14583`)
230+
# GH14583: If meta keys are not always present a new option to set errors='ignore' has been implemented
231231
i = {
232232
"Trades": [{
233233
"general": {

0 commit comments

Comments
 (0)