简体   繁体   中英

Not able to import json file on google colab

I am trying to import json file for the first time on google colab. This file is getting imported on my jupyter notebook without causing any problem.

This is my code:-

df=pd.read_json("E:/Data Science/FlipRobo/Assignments/NLP Sept project/Cell_Phones_and_Accessories.json", orient='records',dtype='dict')
df.head()


It is giving error as below:-

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-16-bb0b9f3e9bb6> in <module>()
----> 1 df=pd.read_json("E:/Data Science/FlipRobo/Assignments/NLP Sept project/Cell_Phones_and_Accessories.json", orient='records',dtype='dict')
      2 df.head()

5 frames
/usr/local/lib/python3.6/dist-packages/pandas/io/json/_json.py in _parse_no_numpy(self)
   1106         else:
   1107             self.obj = DataFrame(
-> 1108                 loads(json, precise_float=self.precise_float), dtype=None
   1109             )
   1110 

ValueError: Expected object or value

Could someone help me with this?

You are trying to access a local file from a cloud service. First you have to upload you file to the colab environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM