Jun-02-2026, 02:20 PM
I was trying to read a table with many columns in scientific notation into a numpy array. When I tried to cnvert the input strings into flating points numbers using:
M_d1 = M_d1.astype(float)
I got this error:
ValueError: could not convert string to float: np.str_('1.01E−03')
I took me a while to catch the issue: it lies in that little "−". It is not a dash ("-") , but an em-dash ("−"). I then changed all the occurrences of this em-dash in my table and now numpy runs smoothly, thus it does not recognize em-dash.
M_d1 = M_d1.astype(float)
I got this error:
ValueError: could not convert string to float: np.str_('1.01E−03')
I took me a while to catch the issue: it lies in that little "−". It is not a dash ("-") , but an em-dash ("−"). I then changed all the occurrences of this em-dash in my table and now numpy runs smoothly, thus it does not recognize em-dash.
