doc changes · ischurov/pandas@2028924 (original) (raw)
3 files changed
lines changed
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -62,6 +62,7 @@ Other enhancements | ||
| 62 | 62 | - ``pd.DataFrame.plot`` now prints a title above each subplot if ``suplots=True`` and ``title`` is a list of strings (:issue:`14753`) |
| 63 | 63 | - ``pd.Series.interpolate`` now supports timedelta as an index type with ``method='time'`` (:issue:`6424`) |
| 64 | 64 | - ``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`) | |
| 65 | 66 | |
| 66 | 67 | |
| 67 | 68 | .. _whatsnew_0200.api_breaking: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -743,7 +743,8 @@ def json_normalize(data, record_path=None, meta=None, | ||
| 743 | 743 | path to records is ['foo', 'bar'] |
| 744 | 744 | meta_prefix : string, default None |
| 745 | 745 | 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 | |
| 747 | 748 | |
| 748 | 749 | Returns |
| 749 | 750 | ------- |
| @@ -849,9 +850,7 @@ def _recursive_extract(data, path, seen_meta, level=0): | ||
| 849 | 850 | if errors == 'ignore': |
| 850 | 851 | meta_val = np.nan |
| 851 | 852 | 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) | |
| 855 | 854 | meta_vals[key].append(meta_val) |
| 856 | 855 | |
| 857 | 856 | records.extend(recs) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -227,7 +227,7 @@ def test_nested_flattens(self): | ||
| 227 | 227 | |
| 228 | 228 | |
| 229 | 229 | 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 | |
| 231 | 231 | i = { |
| 232 | 232 | "Trades": [{ |
| 233 | 233 | "general": { |