简体   繁体   English

Python、Pandas、雅虎财经API

[英]Python, Pandas, Yahoo Finance API

Having trouble getting Pandas data reader to retrieve price quotes from Yahoo's API. The most up to date answer seems to be:无法让 Pandas 数据读取器从雅虎的 API 检索报价。最新的答案似乎是:

"pip install --upgrade pandas pip install --upgrade pandas-datareader “pip 安装 --upgrade pandas pip 安装 --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?但是,目前我将使用 Google Collab 及其 Python 平台,有人知道如何在这里更新 pandas 吗? Or has the API truly just been discontinued?或者 API 真的刚刚停产了吗?

Yahoo API works for me.雅虎 API 为我工作。 Not sure which wrapper you're using (there are a ton).不确定您使用的是哪种包装纸(有很多)。 Try yfinance .尝试yfinance

From Colab: !pip install yfinance来自 Colab: !pip install yfinance

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

Great docs here .这里有很棒的文档。

In Colab you need to put a !在 Colab 中,你需要放一个! before pip pip之前

Okay, so I found the answer!好的,所以我找到了答案! Just as PythonPerfection said above ^ the code does require a !正如 PythonPerfection 上面所说的那样^代码确实需要一个! before the pip.在 pip 之前。

However, Google Colab only has pandas update up until 1.3.5:然而,Google Colab 在 1.3.5 之前只有 pandas 更新:

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错误:找不到满足 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) 错误:没有匹配的分布为熊猫找到==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检查 Pandas 网站我可以看到他们实际上有一个版本高达 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?这可能是问题所在 - 但我仍然想知道雅虎是否已停产 API?

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

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