Load JSON data
Many open data portals make available JSONs datasets that are particularly easy to parse. They can be accessed directly via URL. Each object is a record, all objects have the same set of attributes, and none of the values are nested objects that themselves need to be parsed.
The New York City Department of Homeless Services Daily Report is such a dataset, containing years' worth of homeless shelter population counts. You can view it in the console before loading it to a dataframe with pandas
's read_json()
function.
Este ejercicio forma parte del curso
Streamlined Data Ingestion with pandas
Instrucciones del ejercicio
- Get a sense of the contents of
dhs_daily_report.json
, which are printed in the console. - Load
pandas
aspd
. - Use
read_json()
to loaddhs_daily_report.json
to a dataframe,pop_in_shelters
. - View summary statistics about
pop_in_shelters
with the dataframe'sdescribe()
method.
Ejercicio interactivo práctico
Prueba este ejercicio completando el código de muestra.
# Load pandas as pd
____
# Load the daily report to a dataframe
pop_in_shelters = ____
# View summary stats about pop_in_shelters
print(____)