Python、Pandas、雅虎财经 API

发布于 2025-01-12 21:08:18 字数 208 浏览 1 评论 0原文

无法让 Pandas 数据读取器从雅虎 API 检索报价。最新的答案似乎是:

“pip安装--升级pandas pip安装--升级pandas-datareader

但是,目前我将使用 Google Collab 及其 Python 平台,有人知道如何在这里更新 pandas 吗?或者 API 真的刚刚停止使用吗? ?

Having trouble getting Pandas data reader to retrieve price quotes from Yahoo’s API. The most up to date answer seems to be:

"pip install --upgrade pandas pip install --upgrade pandas-datareader

However, for the time being I will be using Google Collab and its Python platform, does anyone know how to update the pandas here? Or has the API truly just been discontinued?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

美胚控场 2025-01-19 21:08:18

雅虎 API 对我有用。不确定您使用的是哪种包装器(有很多)。
尝试yfinance

来自 Colab:!pip install yfinance

import yfinance as yf
msft = yf.Ticker("MSFT")
msft.info

很棒的文档此处

Yahoo API works for me. Not sure which wrapper you're using (there are a ton).
Try yfinance.

From Colab: !pip install yfinance

import yfinance as yf
msft = yf.Ticker("MSFT")
msft.info

Great docs here.

清风夜微凉 2025-01-19 21:08:18

在 Colab 中,您需要在 pip 之前添加 !

In Colab you need to put a ! before pip

寻找我们的幸福 2025-01-19 21:08:18

好吧,所以我找到了答案!正如 PythonPerfection 上面所说的 ^ 代码确实需要在 pip 之前有一个 !

然而,Google Colab 仅在 1.3.5 之前更新了 pandas:

错误:找不到满足 pandas==1.4.1 要求的版本(来自版本:0.1、0.2、0.3.0、0.4.0、0.4.1、0.4.2、0.4.3、0.5。 0、0.6.0、0.6.1、0.7.0、0.7.1、 0.7.2、0.7.3、0.8.0、0.8.1、0.9.0、0.9.1、0.10.0、0.10.1、0.11.0、0.12.0、0.13.0、0.13.1、0.14。 0、0.14.1、0.15.0、 0.15.1、0.15.2、0.16.0、0.16.1、0.16.2、0.17.0、0.17.1、0.18.0、0.18.1、0.19.0、0.19.1、0.19.2、0.20。 0, 0.20.1, 0.20.2、0.20.3、0.21.0、0.21.1、0.22.0、0.23.0、0.23.1、0.23.2、0.23.3、0.23.4、0.24.0、0.24.1、0.24。 2、0.25.0、 0.25.1、0.25.2、0.25.3、1.0.0、1.0.1、1.0.2、1.0.3、1.0.4、1.0.5、1.1.0、1.1.1、1.1.2、1.1。 3、1.1.4、1.1.5、1.2.0、 1.2.1、1.2.2、1.2.3、1.2.4、1.2.5、1.3.0、1.3.1、1.3.2、1.3.3、1.3.4、1.3.5)
错误:找不到 pandas==1.4.1 的匹配发行版

检查 Pandas 网站,我可以看到他们实际上有 1.4.1 版本:
https://pandas.pydata.org/pandas-docs/stable/ Whatsnew/index.html

这可能是问题所在 - 但我仍然想知道雅虎是否已经停止使用它的 API?

Okay, so I found the answer! Just as PythonPerfection said above ^ the code does require a ! before the pip.

However, Google Colab only has pandas update up until 1.3.5:

ERROR: Could not find a version that satisfies the requirement pandas==1.4.1 (from versions: 0.1, 0.2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.6.0, 0.6.1, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0, 0.21.1, 0.22.0, 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.24.0, 0.24.1, 0.24.2, 0.25.0, 0.25.1, 0.25.2, 0.25.3, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5)
ERROR: No matching distribution found for pandas==1.4.1

Checking Pandas website I can see they actually have a release up to 1.4.1:
https://pandas.pydata.org/pandas-docs/stable/whatsnew/index.html

This may be the issue - but I would still like to know if Yahoo has discontinued it API?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文