How to convert that html table to pandas dataframe?
https://www.google.com/finance/getprices?q=HINDALCO&i=60&p=15d&f=d,o,h,l,c,v
Example data:
You can use read_csv
with parameters skiprows
and names
for new column names:
url = 'https://www.google.com/finance/getprices?q=HINDALCO&i=60&p=15d&f=d,o,h,l,c,v'
df = pd.read_csv(url, skiprows=[0,1,2,3,5,6]).rename(columns={'COLUMNS=DATE':'DATE'})
print (df.head())
DATE CLOSE HIGH LOW OPEN VOLUME
0 a1490154300 194.80 194.80 194.80 194.80 2600
1 1 193.55 194.70 193.00 194.15 339142
2 2 193.80 193.95 193.55 193.60 242687
3 3 194.20 194.40 193.80 193.90 119874
4 4 193.80 194.20 193.80 194.20 121355