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.
Bu egzersiz
Streamlined Data Ingestion with pandas
kursunun bir parçasıdırEgzersiz talimatları
- Get a sense of the contents of
dhs_daily_report.json, which are printed in the console. - Load
pandasaspd. - Use
read_json()to loaddhs_daily_report.jsonto a dataframe,pop_in_shelters. - View summary statistics about
pop_in_shelterswith the dataframe'sdescribe()method.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
# Load pandas as pd
____
# Load the daily report to a dataframe
pop_in_shelters = ____
# View summary stats about pop_in_shelters
print(____)