Home > other >  About numpy array in attaching the where doubts when using generic function
About numpy array in attaching the where doubts when using generic function

Time:11-23

Is shown in the following example, array b ascribed value with additional where generic function can get the correct result, but not in universal function assignment directly using array and the where will produce an error results. Please explain what, thank you.
 
The import numpy as np
B=np. Array ((... 0, 30, 45, 60, 90.)) * np in PI/180
Print (b)
Print ()
Print (np. Sin (b, where=[True, False, True, False, True)))
Print ()
Print (np) sin (np) array ((... 0, 30, 45, 60, 90.)) * np in PI/180, where=[True, False, True, False, True)))

# out:
[0. 0.52359878 0.78539816 1.04719755 1.57079633]

[0. 0.52359878 0.70710678 1.04719755 1]

[0. 94.24777961 0.70710678 188.49555922 1]
  • Related