I do not understand what .astype () does - does it round numbers? And the second question as a consequence of the first: tell me how to change the function with lambda to change the array as necessary. Now:
[[ 0.69053728] [ 2.7581594 ] [-5.50454002]] A = lambda x: (x >= 1).astype(float) I get at the output:
[[ 0] [ 1] [ 0]] How to do to get:
[[ 0] [ 1] [-1]] Those. negative numbers less than -1 should turn into -1.
numpy(if we are talking about it) is not quite a python. Here is the link numpy.ndarray.astype - Sour Sourse