用yfinance提取连续数据



python和yfnance的新手,但如何获得长格式的所有数据,而不被"quot;在中间,如在下面的例子中的日期2020-01-08和2020-01-25之间?非常感谢。(使用Spyder(

import sys
sys.path.append("/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages")
import yfinance as yf
data = yf.download("AAPL", start="2020-01-01", end="2021-02-01")
print(data)
[*********************100%***********************]  1 of 1 completed
Open        High  ...   Adj Close     Volume
Date                                ...                       
2020-01-02   74.059998   75.150002  ...   74.333511  135480400
2020-01-03   74.287498   75.144997  ...   73.610840  146322800
2020-01-06   73.447502   74.989998  ...   74.197395  118387200
2020-01-07   74.959999   75.224998  ...   73.848442  108872000
2020-01-08   74.290001   76.110001  ...   75.036385  132079200
...         ...  ...         ...        ...
2021-01-25  143.070007  145.089996  ...  142.706757  157611700
2021-01-26  143.600006  144.300003  ...  142.946396   98390600
2021-01-27  143.429993  144.300003  ...  141.848038  140843800
2021-01-28  139.520004  141.990005  ...  136.885452  142621100
2021-01-29  135.830002  136.740005  ...  131.763107  177180600

[272 rows x 6 columns]

yfnance返回一个pandas.Dataframe对象。为了看到完整的返回,请导入pandas包并运行set_option方法来增加要显示的最大行数。这是代码:

import pandas as pd
pd.set_option('display.max_rows', 500)

相关内容

  • 没有找到相关文章

最新更新