valueerror: expected object or value – Python Pandas

Total
0
Shares

When reading JSON as pandas dataframe, we sometimes get the valueerror: expected object or value. The primary reasons for this error are –

  • JSON file path is not correct.
  • Error in JSON format.

So, first of all check if your file path is correct. Pandas can accept any valid file path including the URLs like http(s), ftp, s3 etc. You can use the local paths like – file:///C:/Users/akash/Downloads/myfile.json.

import pandas as pd
data= pd.read_json('file:///C:/Users/akash/Downloads/myfile.json')

    Tweet this to help others

Learn more about read_json.

Sign Up for Our Newsletters

Get only the best articles delivered to your mail

You May Also Like