TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

刘超 2月前 ⋅ 357 阅读   编辑

一、描述
    使用~np.isnan(na)求非nan,当数据量大的时候,报如下错误

Traceback (most recent call last):
  File "adx_billing_report.py", line 226, in <module>
    run(args)
  File "adx_billing_report.py", line 209, in run
    funcImpl(args)
  File "adx_billing_report.py", line 198, in insert
    dspDF = patchRepair(dspDF,patchDF)
  File "adx_billing_report.py", line 109, in patchRepair
    operaDF = adIdMergeDF[~np.isnan(adIdMergeDF['spend_adId'])]
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

二、解决方法
    使用pd.notna(na)即可


注意:本文归作者所有,未经作者允许,不得转载

全部评论: 0

    我有话说: