O'Reilly logo

Learning pandas - Second Edition by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reading and writing JSON files

Pandas can read and write data stored in the JavaScript Object Notation (JSON) format. This is one of my favorites, due to its ability to be used across platforms and with many programming languages.

To demonstrate saving as JSON, we will first save the Excel data we just read into a JSON file and examine the contents:

JSON-based data can be read with the pd.read_json() function:

Note the two slight differences here, caused by the reading/writing of data from JSON. First, the columns have been reordered alphabetically. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required