Search code examples
pythonparse-error

Unable to parse string "ACTL6AS5" at position 0


This is another error I am getting:- Unable to parse string "ACTL6AS5" at position 0

What is meant by this error?

ValueError                                Traceback (most recent call last)
pandas\_libs\lib.pyx in pandas._libs.lib.maybe_convert_numeric()

ValueError: **Unable to parse string "ACTL6AS5"**

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-51-c08b0b717a59> in <module>
----> 1 Combined_data_df["features"] = Combined_data_df ["features"].apply(pd.to_numeric)

I have attempted to fix it like this:- 

#Trying to fix error 'unable to parse string 'ACTL6A_S5' at position 0
print (Combined_data_df[pd.to_numeric(Combined_data_df.features, errors='coerce').isnull()])

Is this the right fix?

Thank you!


Solution

  • You can't convert a string with letters to numeric, but yes you can coerce them to be NaN.