fsspec为什么是可选依赖项,当你需要它来使用pandas读取CSV文件时?

huangapple go评论51阅读模式
英文:

Why is fsspec an optional dependency, when you need it to read a csv file with pandas?

问题

我经常使用pandas包,所以我在我的主要工作计算机上将其全局可用。这是相当久以前的事情,所以我无法回想起以前安装时的所有细节,但我不记得需要额外安装可选依赖项fsspec

最近,我尝试在家里完成一些工作,不得不在另一台计算机上再次运行pip install pandas,我很惊讶地发现从<s>local</s> csv文件中读取失败,因为fsspec被视为可选依赖项。

为什么将它设置为可选依赖项而不自动安装为必需依赖项呢?

编辑: 原来我不小心在路径中多输入了一个斜杠,将c://写成了c:/。我猜测多余的斜杠可能设置了一个标志,以将路径的其余部分识别为远程文件?

英文:

I use the pandas package quite a bit, so I've made it globally available on my main work computer. I did this quite awhile ago, so I can't recall all the details to what I did when installing in the past, but I don't remember having to take an extra step in installing the optional dependency, fsspec.

I recently tried to get a little work done at home, and I had to pip install pandas again on another computer, and I was surprised to see that reading from a <s>local</s> csv file failed because fsspec was considered an optional dependency.

What's the reasoning behind making it optional instead of automatically installing it as a required dependency?

edit: It turns out I just fat-fingered the path and put c:// instead of c:/. I'm assuming the extra slash set a flag to recognize the rest of the path as a remote file?

答案1

得分: 2

文档中所提到的:

所有非本地文件或HTTP(s)的URL都由fsspec处理,如果已安装,以及其各种文件系统实现(包括Amazon S3,Google Cloud,SSH,FTP,webHDFS...)。

至于为什么是可选的 - 这是开发者的决定,但我会预期,如果不使用远程文件,它不是必需的,所以他们决定将其作为可选项。

英文:

As mentioned in the docs:

> All URLs which are not local files or HTTP(s) are handled by fsspec,
> if installed, and its various filesystem implementations (including
> Amazon S3, Google Cloud, SSH, FTP, webHDFS…).

As to why is optional - it's developer's decision, but I would expect that as it is not required if you don't work with remote files, you don't need it, so they decided t leave it optional.

huangapple
  • 本文由 发表于 2023年2月18日 15:07:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/75491750.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定