Reputation: 135
I am trying to read in a csv from a url (csv link) then isolate the ticker symbols (AMLP, ARKF, ARKG, ARKK, etc.), but I am running into a problem just reading in the csv.
The exact error is: "pandas.errors.ParserError: Error tokenizing data. C error: Expected 8 fields in line 3, saw 12".
My code is as follows:
import pandas as pd
df = pd.read_csv("https://www.cboe.com/available_weeklys/get_csv_download/")
print(df)
Upvotes: 0
Views: 181
Reputation: 23146
Try with:
df = pd.read_csv("https://www.cboe.com/available_weeklys/get_csv_download/", error_bad_lines=False)
If you just want to start from line 16 in the file (where AMLP is), use:
df = pd.read_csv("https://www.cboe.com/available_weeklys/get_csv_download/", skiprows=15, header=None)
>>> df
0 1
0 AMLP ALPS ETF TR ALERIAN MLP
1 ARKF ARK ETF TR FINTECH INNOVA
2 ARKG ARK ETF TR GENOMIC REV ETF
3 ARKK ARK ETF TR INNOVATION ETF
4 ASHR DBX ETF TR XTRACK HRVST CSI
.. ... ...
610 YY JOYY INC ADS REPSTG COM A
611 Z ZILLOW GROUP INC CL C CAP STK
612 ZM ZOOM VIDEO COMMUNICATIONS INC CL A
613 ZNGA ZYNGA INC CL A
614 ZS ZSCALER INC COM
Upvotes: 1