Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"full" does not work
#1
Hello, a program hast he following line:

Moth_fitness=numpy.full(N,float("inf"))
When I try to run the program that has this line of code I receive this:

AttributeError: 'module' object has no attribute 'full'
What can I do to make it work OR to replace it (I don't know what "inf" means)

Can I replace it with:

for i in range(0,N):
             #do something with "Moth_fitness" 
Reply
#2
Are you using an older version of NumPy that doesn't have full? Of course you could create an array of 1s (using numpy.ones) and then multiply that by the infinity value. Note also that NumPy has an inf constant to represent infinity.
Reply


Forum Jump:

User Panel Messages

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