Python Forum

Full Version: "full" does not work
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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" 
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.