Week 11: Visualization

When I retrieve the json file, I do not see it in the right format. PFB. What is wrong?

I used the statement : `urllib.request.urlretrieve(url,‘data.json’)`

I am also getting an error when I use the below command

Can anyone please help?

The code that I have used:

pls try following:

import numpy as np

import pandas as pd

import seaborn as sns

import json

import urllib.request

#read the data

urllib.request.urlretrieve(“https://api.covid19india.org/states_daily.json”, “data1.json”)

with open(“data1.json”) as f:

js = json.load(f)


df = pd.json_normalize(js[‘states_daily’])

df1 = df.copy()

df1.drop(columns=[‘un’, ‘dateymd’], axis=1, inplace=True)

#set date time

df1[‘date’] = pd.to_datetime(df1[‘date’])

df1.set_index(‘date’, inplace=True)

basically url issue from site.


Thanks for the help! I was using the wrong url.