📜  无法将浮点 nan 转换为整数 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:51.534000             🧑  作者: Mango

代码示例1
# x contained NaN
df = df[~df['x'].isnull()]

# Y contained some other garbage, so null check was not enough
df = df[df['y'].str.isnumeric()]

# final conversion now worked
df[['x']] = df[['x']].astype(int)
df[['y']] = df[['y']].astype(int)