我如何显示yfinancedata witout日期

发布于 2025-02-06 17:20:23 字数 215 浏览 2 评论 0原文

import yfinance as yf
data = yf.download('AAPL')
print(data['Open'].tail(1).to_string())

结果是

Date            Open
2022-06-09    36.849998

我想删除任何人可以帮我吗?

import yfinance as yf
data = yf.download('AAPL')
print(data['Open'].tail(1).to_string())

the result is

Date            Open
2022-06-09    36.849998

I want to remove the date can anyone help me please?

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

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

发布评论

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

评论(1

最美的太阳 2025-02-13 17:20:23
print(data['Open'].values[1])

关键是数据将以数据框架返回。如果要提取一个值,请使用方括号中的值来指定索引。由于此数据框中的索引是日期,因此您也可以提取它们,例如:

print(data['Open'].index[1])
print(data['Open'].values[1])

the point is that the data is returned as a dataframe. If you want to extract a value, then use values in square brackets to specify the index. Since the indexes in this dataframe are dates, you can also extract them, for example:

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