Код: Выделить всё
import yfinance as yf
df = yf.download("NVDA", period="3y", interval="1wk")
spy = yf.download("SPY", period="3y", interval="1wk")['Close']
df['RS_Ratio'] = df['Close'] / spy
Код: Выделить всё
Traceback (most recent call last):
File "test.py", line 4, in
df['RS_Ratio'] = df['Close'] / spy
~~^^^^^^^^^^^^
File "C:\DEVNEU\.venv\yfinance\Lib\site-packages\pandas\core\frame.py", line 4301, in __setitem__
self._set_item_frame_value(key, value)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "C:\DEVNEU\.venv\yfinance\Lib\site-packages\pandas\core\frame.py", line 4459, in _set_item_frame_value
raise ValueError(
......
)
ValueError: Cannot set a DataFrame with multiple columns to the single column RS_Ratio
Подробнее здесь: https://stackoverflow.com/questions/798 ... t-possible
Мобильная версия