-2

I am trying to run a code in Python.

I upload the libraries as follow:

import requests
import json
from datetime import datetime
import pandas as pd
import re
from pandas.io.json import json_normalize

And when I try to extract information from a web site I receive the following error:

C:\Users\Mike\anaconda3\lib\site-packages\ipykernel_launcher.py:1: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead
  """Entry point for launching an IPython kernel.

What am I doing wrong?

2
  • 1
    is the warning not clear? just use pd.json_normalize as the from pandas.io.json variant seems it will be depreciated in future. Commented May 6, 2020 at 15:12
  • No, the warning is not clear. The suggestion does not solve my issue. Commented May 7, 2020 at 17:06

2 Answers 2

8

Pandas now contains the json_normalize functions as pandas.io.json is deprecated.

Replace this:

from pandas.io.json import json_normalize

With this:

from pandas import json_normalize
Sign up to request clarification or add additional context in comments.

Comments

1

Delete from pandas.io.json import json_normalize from your imports, and replace json_normalize with pd.json_normalize in your code.

3 Comments

Then you need to provide your code or improve the question description. The error you have presented is literally telling you to do this.
When I do the next step: import requests import json from datetime import datetime import pandas as pd import re pd.json_normalize I receive the next answer: <function pandas.io.json._normalize._json_normalize(data: Union[Dict, List[Dict]], record_path: Union[str, List, NoneType] = None, meta: Union[str, List[Union[str, List[str]]], NoneType] = None, meta_prefix: Union[str, NoneType] = None, record_prefix: Union[str, NoneType] = None, errors: Union[str, NoneType] = 'raise', sep: str = '.', max_level: Union[int, NoneType] = None) -> 'DataFrame'>
If I do: import requests import json from datetime import datetime import pandas as pd import re import pandas from pd.json_normalize I get: Invalid syntax

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.