Python Forum
numpy.float64 object is not iterable
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
numpy.float64 object is not iterable
#1
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
Reply
#2
It appears that df["ema_30"][i] is a float. min() requires an iterable as its argument.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Numpy] How to store different data type in one numpy array? water 7 303 Mar-26-2024, 02:18 PM
Last Post: snippsat
  Numpy returns "TypeError: unsupported operand type(s) for *: 'numpy.ufunc' and 'int'" kalle 2 2,530 Jul-19-2022, 06:31 AM
Last Post: paul18fr
  numpy.ndarray' object is not callable natareid 4 3,748 Oct-16-2020, 08:00 AM
Last Post: sanrock123
  'numpy.ndarray' object is not callable ato_cr 1 15,122 May-12-2020, 08:12 AM
Last Post: anbu23
  What is the mechanism of numpy function returning pandas object? Ibaraki 2 2,456 Apr-04-2020, 10:57 PM
Last Post: Ibaraki
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 2,934 Apr-09-2019, 04:54 PM
Last Post: PhysChem
  ValueError: Input contains infinity or a value too large for dtype('float64') Rabah_r 1 12,847 Apr-06-2019, 11:08 AM
Last Post: scidam
  ???Can not convert from <U25 to float64.??? damsel_pie 6 6,808 Aug-23-2018, 04:49 PM
Last Post: Gribouillis
  numpy.float64 and plot_date in matplotlib iv20023 1 5,700 Jun-21-2017, 10:23 PM
Last Post: zivoni

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020