Reputation: 103
After importing the following libraries, I am trying to read a CSV file from here.
`import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
import statsmodels.api as sm
from pandas.core import datetools`
`data = pd.read_csv("https://github.com/marcopeix/ISL-linear-`
regression/blob/master/data/Advertising.csv", sep='delimiter',
header=None,` `engine='python')`
May I please request someone to explain the reason why I am getting HTML tags as output..
`data.head(5)`
` 0
0 <!DOCTYPE html>
1 <html lang="en">
2 <head>
3 <meta charset="utf-8">
4 <link rel="dns-prefetch" href="https://assets-...`
Upvotes: 2
Views: 826
Reputation: 1210
If you go to the Github page, you will find Raw
in the right end as shown in screenshot below. Click the Raw and copy the url of that.
Here is the right url for you:
import pandas as pd
data = pd.read_csv("https://raw.githubusercontent.com/marcopeix/ISL-linear-regression/master/data/Advertising.csv")
Upvotes: 2