'I couldn't fix the error about the pandas library in the heikin ashi calculation

when calculating heikin ashi candles, I get an error about pandas and I can't fix it. Can anyone with knowledge help?

    # LOAD BARS
    bars = exchange.fetch_ohlcv(symbol, timeframe=zamanAraligi, since=None, limit=500)
    df = pd.DataFrame(bars, columns=["timestamp", "open", "high", "low", "close", "volume"])

    bars1 = exchange.fetch_ohlcv(symbol, timeframe=zamanAraligi, since=None, limit=500)
    dfHa = pd.DataFrame(bars1, columns=["timestamp", "open", "high", "low", "close", "volume"])


    for i in range(len(dfHa.index) - 1):
        if i > 0:
            dfHa["open"][i] = (float(dfHa["open"][i - 1]) + float(dfHa["close"][i - 1])) / 2
        dfHa["close"][i] = (float(df["close"][i]) + float(df["open"][i]) + float(df["high"][i]) + float(df["low"][i])) / 4
        dfHa["high"][i] = max(dfHa["high"][i], dfHa["open"][i], dfHa["close"][i])
        dfHa["low"][i] = min(dfHa["low"][i], dfHa["open"][i], dfHa["close"][i])
    print(dfHa)

error messages are in the images below

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source