我有一個dataframe欄位有Open,High,Low,Close,Adj…
Jump to turn (6)
- 1我有一個dataframe欄位有Open,High,Low,Close,Adj Close,Volume,請你使用python的finta跟pandas套件幫我
- 2請幫忙想14項常見的技術指標,並且是使用finta可以製作出來的,然後使用finta計算這14項技術指標並將其合併到dataframe
- 3將你上面列出的指標排除[RSI,SMA,EMA,ATR,CCI,STOCH\K,STOCH\D,OBV,ROC],剩那些?
- 4在幫忙想6項技術指標(已經有的就不用了)然後用finta計算並合併到dataframe裡面
- 5程式碼完成了嗎?
- 6AttributeError: type object 'TA' has no attribute 'envelopes'
- User
我有一個dataframe欄位有Open,High,Low,Close,Adj Close,Volume,請你使用python的finta跟pandas套件幫我這個dataframe計算RSI技術指標,並將計算結果合併到dataframe欄位名稱叫RSI
- Assistant
好的,以下是使用Python的finta和pandas套件計算RSI技術指標的方法:
首先,我們需要安裝finta套件,可以在終端機中輸入以下指令進行安裝:
codepip install finta接下來,我們可以使用pandas套件讀取資料並建立DataFrame物件,例如:
pythonimport pandas as pd # 讀取資料 df = pd.read_csv('data.csv') # 建立DataFrame物件 df = pd.DataFrame(df)接著,我們可以使用finta套件中的RSI函式來計算RSI指標,例如:
pythonfrom finta import TA # 計算RSI指標 rsi = TA.RSI(df) # 將RSI指標合併到DataFrame物件中 df['RSI'] = rsi最後,我們可以使用pandas套件的to_csv方法將計算結果輸出到檔案中,例如:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.