简体   繁体   English

如何从 Pandas 中的 url 读取 CSV? - 错误标记数据

[英]How to Read CSV from url in pandas? - error tokenizing data

How can I download this following file in python?如何在python中下载以下文件? I have no issue doing this in R. I believe this issue is the last row in the file which will change.我在 R 中这样做没有问题。我相信这个问题是文件中将更改的最后一行。 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) 

You should better download the csv file first by using the requests module .您最好先使用请求模块下载 csv 文件。 Then you can read the file from the download directory by passing the file path instead of the URL ( pd.read_csv(download_path) ).然后您可以通过传递文件路径而不是 URL ( pd.read_csv(download_path) ) 从下载目录读取文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM