Closed
Description
Reproducing code example:
import numpy as np
print(np.__version__)
arr = np.array(['AAAAA', 18465886.0, 18465886.0], dtype=object)
print(arr.astype(np.complex64))
print(arr.astype(np.complex64))
Error message:
Python3.6 works as I would expect (complains that it cannot convert a string to complex dtype)
$ python3.6 test.py
1.16.0.dev0+7fcba41
Traceback (most recent call last):
File "test.py", line 4, in <module>
print(arr.astype(np.complex64))
TypeError: must be real number, not str
Python3.7 converts it to a complex type and then errors if you try to do it again
$ python3.7 test.py
1.16.0.dev0+7fcba41
[-6.3090155e-31+4.558e-41j 1.8465886e+07+0.000e+00j
1.8465886e+07+0.000e+00j]
Traceback (most recent call last):
File "test.py", line 5, in <module>
print(arr.astype(np.complex64))
TypeError: must be real number, not str
Numpy/Python version information:
>>> import sys
>>> sys.version
'3.7.0b3 (default, Mar 30 2018, 04:35:22) \n[GCC 7.3.0]'
>>> import numpy as np
>>> np.__version__
'1.16.0.dev0+7fcba41'
Metadata
Metadata
Assignees
Labels
No labels