1

I was trying to use json_normalize function to flatten the JSON data. While calling the function I am getting this exception in Python;

AttributeError: module 'pandas' has no attribute 'json_normalize'

I'm using Python 3.8-Azure ML and used this;

from pandas.io.json import json_normalize

How can we import this?

3 Answers 3

1

Try to

from pandas import json_normalize

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.json_normalize.html

Sign up to request clarification or add additional context in comments.

Comments

1

json_normalize is coming from pandas directly

So what you have to import is:

from pandas import json_normalize

9 Comments

tried that, but still getting an error; \ ImportError: cannot import name 'json_normalize'
what pandas version you have btw ?
Python 3.6-Azure ML
Pandas version, not python. You can do smth like import pandas as pd and then print(pd.__version__)
ah cool nice. your version was a bit old and was trying to set up a venv with it to check your issue out of curiosity
|
-1

try to upgrade pandas.

pip3 install --upgrade pandas

Edit: The json_normalize() function was introduced in pandas 0.19.2. If you are getting this error then you might be using an older version.

2 Comments

Please explain why you think this solves the issue.
The json_normalize() function was introduced in pandas 0.19.2. If you are getting this error then you might be using an older version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.