Skip to content

A simple Python script to convert SingStat table data from JSON to CSV

Notifications You must be signed in to change notification settings

xkexuan/singstat-tables

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

JSON to CSV

This is a simple script written to make an API call to one of SingStat's many commonly accessed tables, parse and extract data from the JSON response, and write the output as a .csv file.

Usage

This script was originally developed to write the JSON response of the International Visitor Arrivals data as a .csv file.

No. Subject Topic Title CSV JSON
1 Tourism International Visitor Arrivals International Visitor Arrivals By Inbound Tourism Markets, Monthly CSV JSON

Modifications

For usage on other commonly accessed tables available on the SingStat website, modification of the script is required by specifying the unique API endpoint, and also depending on which data elements need to be extracted.

Versions

Two versions of the script are available.

For use on local machine or IDE

This version JSON_to_CSV_Local.py can be executed in the terminal or IDE:

python JSON_to_CSV_Local.py

The output .csv will be saved in the current working directory.

For use in Datorama

This version JSON_to_CSV_Datorama.py is modified for use in Datorama to automate the ingestion of data into a Datorama data stream. In this version, the output .csv is automatically uploaded to Datorama and will not be stored on the local machine.

To automate data retrieval in Datorama:

  1. Specify Frequency (e.g. Daily) and Delivery Hour (e.g. 06)
  2. Ensure that "Enable Data Retrieval" is selected

About

A simple Python script to convert SingStat table data from JSON to CSV

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages