0

How can I download this following file in python? I have no issue doing this in R. I believe this issue is the last row in the file which will change. How can I change the code to work?

import pandas as pd
 url = "https://ark-funds.com/wp-content/uploads/funds-etf-csv/ARK_INNOVATION_ETF_ARKK_HOLDINGS.csv"
test = pd.read_csv(url) 
user2946746
  • 1,740
  • 3
  • 21
  • 36
  • 3
    What's the error? – Riley Nov 06 '21 at 00:36
  • 1
    if you are getting 403 - forbidden error, then refer to this post [request with header](https://stackoverflow.com/questions/55711159/pandas-read-csv-from-url-and-include-request-header/55711425) – simpleApp Nov 06 '21 at 02:37

1 Answers1

0

You should better download the csv file first by using the requests module. Then you can read the file from the download directory by passing the file path instead of the URL (pd.read_csv(download_path)).

Thomas Kutsch
  • 11
  • 1
  • 2