【问题标题】:Unable to parse string "ACTL6AS5" at position 0无法解析位置 0 处的字符串“ACTL6AS5”
【发布时间】:2022-01-18 13:00:48
【问题描述】:

这是我遇到的另一个错误:- 无法解析位置 0 处的字符串“ACTL6AS5”

这个错误是什么意思?

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()])

这是正确的解决方法吗?

谢谢!

【问题讨论】:

    标签: python parse-error


    【解决方案1】:

    您不能将带有lettersstring 转换为numeric,但是您可以将coerce 转换为NaN

    【讨论】:

    猜你喜欢
    • 2023-03-28
    • 2019-09-07
    • 1970-01-01
    • 2020-10-16
    • 1970-01-01
    • 2021-06-09
    • 2017-07-23
    • 1970-01-01
    相关资源
    最近更新 更多