Python Forum

Full Version: numpy.float64 object is not iterable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I am a newbie in Python, trying out various ways to play around with Python, i am currently using version 3.7, I am trying to tweak a code which i learnt from Youtube, but this error came out when I was trying to run the code in cmd prompt.

Error:
Traceback (most recent call last): File "2", line 42, in <module> cmin=min(df["Ema_30"][i]) TypeError: 'numpy.float64' object is not iterable
Below is a snipet of the code that i amended,
emasUsed=[3,5,8,10,12,15,30,35,40,45,50,60]
for x in emasUsed:
    ema=x
    df["Ema_"+str(ema)]=round(df.iloc[:,4].ewm(span=ema, adjust=False).mean(),2)

print(df.tail())

pos=0
num=0
percentchange=[]

for i in df.index:
    cmin=min(df["Ema_30"][i])
    cmax=max(df["Ema_60"][i])
Can anyone explain to me what is the error that I am facing here.

Thanks
It appears that df["ema_30"][i] is a float. min() requires an iterable as its argument.