79157880

Date: 2024-11-05 06:26:58
Score: 1.5
Natty:
Report link

Best way to do this is as follows:

df['col'] = df['col'].apply(pd.to_numeric,errors='coerce').astype(pd.Int32Dtype())

So it will first convert any invalid integer value to NaN first & then to NA

Reasons:
  • Low length (0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Vikas Garud