Learn practical skills, build real-world projects, and advance your career
import jovian
jovian.commit()
[jovian] Attempting to save notebook..
#Firstly, we import pandas, numpy and matplotlib with aliases to make calling them easier
import pandas as pd
import numpy as np
import matplotlib as plt
#We send an request to the API asking for the selic time-series.
#The code for this time series is 11. 
#We use "convert_dates" to cast this column to a datetime format.

selic_df = pd.read_json('http://api.bcb.gov.br/dados/serie/bcdata.sgs.{}/dados?formato=json'.format(11))
#The date column is formatted as a string. Lets convert it to datetime
selic_df['data'] = pd.to_datetime(selic_df['data'], dayfirst=True)

#Now we can slice the dataframe to filter a specific period
selic_df = selic_df[selic_df.data>='2020-01-01'].reset_index(drop=True)

selic_df