Sample DataFrame data1 = [ {"categoryID": 9, "params": [{"value": "MzI5MjAy"}, {"id":…
- User
Sample DataFrame
data1 = [ {"categoryID": 9, "params": [{"value": "MzI5MjAy"}, {"id": 147411, "value": "MzIzNjM0OQ=="}]}, # Missing 'id' in the first dictionary {"categoryID": 9, "params": [{"id": 110000, "value": "MzI5MjY4"}, {"id": 110001, "value": "MzMwMTQ0"}, {"id": 147411, "value": "MzIzNjM0Nw=="}]}, {"categoryID": 9, "params": [{"id": 110000, "value": "MzI5Mjgz"}, {"id": 110001, "value": "MzMwMzcy"}, {"id": 147411, "value": "WzMyMzYzMzdd"}]}, {"categoryID": 9, "params": [{"id": 110000, "value": "MzI5Mjgz"}, {"id": 10001, "value": "MzMwMzcy"}, {"id": 147411, "value": "MzIzNjMzNw=="}]} ]
df = pd.DataFrame(data1)
save data1 to csv
read data2 from csv
- Assistant
Certainly! Below is Python code that saves the
data1DataFrame to a CSV file and reads another DataFrame (data2) from the CSV file.python - User
JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 3 (char 2)
- Assistant
The
JSONDecodeErroryou encountered indicates that some JSON data in theparamscolumn is not formatted correctly. Specifically, when the data was saved to CSV, the lists of dictionaries in theparamscolumn were turned into string representations that are not directly JSON-compatible.