Home > other >  Numpy, use numpy. NAN will a list of strings into a null value, can only get results na
Numpy, use numpy. NAN will a list of strings into a null value, can only get results na

Time:11-15

Specific code as shown in figure
Could you tell me how to solve the

CodePudding user response:

Can't use None?

CodePudding user response:

I met the problem is, I'm free list of values, the print out is, 'rather than' nan ', '
In the process of put the list into matrix, 'is the string format, cannot be converted to floating point, not into matrix,
See article said the numpy nan is a float, so want to try to ' 'to' nan ', to float,
But with the cols [cols==']=np, NAN, is still empty value ', 'not' NAN ',
Collapse,

CodePudding user response:

 

T_change=np. Arange (24). Reshape ((4, 6))
Less than 10 to 10 # principle, more than 18 replaced with 18, the rest remains the same
T_change=t_change. Astype (float)
T_change [3, 4, 5]]=np, NaN
Print (t_change)
T_result=t_change. Clip (10, 18)
Print ('='* 30)
Print (t_result)

CodePudding user response:

To convert your array to float type, and then assign a value