HTTP Error 403: Forbidden while reading csv file

Viewed 32

I want to read live csv file with pandas but I am getting 404 error. I understood, it means server is rejecting unknown request

import pandas as pd
site= "https://demo-live-data.highcharts.com/time-data.csv"
df = pd.read_csv(site)

I also tried it with beautiful soup and request. By that I was getting another error

1 Answers
import pandas as pd
import io
import requests

site = r"https://demo-live-data.highcharts.com/time-data.csv"
s = requests.get(site).content
df = pd.read_csv(io.StringIO(s.decode('utf-8'))) 
df.head()
Related