0

我有以下代码:

import numpy as np 
import pandas as pd
import yfinance as yf
from yahoofinancials import YahooFinancials

yahoo_financials = YahooFinancials('BTC-USD')
data = yahoo_financials.get_historical_price_data("2014-09-17", "2021-11-15", "daily")
btc = pd.DataFrame(data['BTC-USD']['prices'])
btc = btc.drop('date', axis=1).set_index('formatted_date')

但是,运行最后一行代码会给我以下错误:TypeError: int() argument must be a string, a bytes-like object or a number, not '_NoValueType'. 我知道错误很受欢迎。问题是我尝试的所有解决方案都不起作用。我试图将感兴趣的列转换为,int()但无法对其进行排序。str()float()

我究竟做错了什么?

谢谢!

4

1 回答 1

1

我也试过你的代码,它工作正常,尝试 pip install yahoofinancials 和 pip install yfinance 并重新启动内核 mybye 它会工作,祝你好运。

于 2021-11-16T08:45:05.930 回答