Exporting data to JSON, CSV, and Excel
While as producers of data visualization, we are mostly using other people's data, importing and reading data are our major activities. We do need to write or export data that we produced or processed, whether it is for our or others' current or future use.
We will demonstrate how to use the previously mentioned Python modules to import, export, and write data to various formats such as JSON, CSV, and XLSX.
For demonstration purposes, we are using the pregenerated dataset from the Importing data from fixed-width data files recipe.
Getting ready
For the Excel writing part, we will need to install the xlwt
module (inside our virtual environment) by executing the following command:
$ pip install xlwt
How to do it... ...
Get Python Data Visualization Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.