I have the following colab notebook that has always worked for me, however now I am receiving the following error: "ImportError: numpy.core.multiarray failed to import"
How can I fix this problem? I have already tried re-installing pands to no avail.
Here is my code:
pip install pandas_ta
!wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
!tar -xzvf ta-lib-0.4.0-src.tar.gz
%cd ta-lib
!./configure --prefix=/usr
!make
!make install
!pip install Ta-lib
from google.colab import files
import os
import pandas as pd
import pandas_ta as ta
def TAfunction(data):
stock_df = pd.read_csv(data)
CustomStrategy = ta.Strategy(
name="RSI Strat",
description = "RSI",
ta=[
{"kind":"rsi"},
{"kind":"bbands", "length": 5},
{"kind":"macd", "fast": 8, "slow":21},
{"kind":"sma", "length": 20},
{"kind":"sma", "length": 50},]
)
stock_df.ta.strategy(CustomStrategy)
stock_df.to_csv(data, encoding = 'utf-8-sig', index=False)
test_dir = '/content/drive/MyDrive/Colab Notebooks/Stocks CSVs/IndCSVs/'
for file in os.listdir(test_dir):
if file.endswith(".csv"):
TAfunction(test_dir + file)