pandas replace non numeric values with 0

36

df.col =pd.to_numeric(df.col, errors ='coerce').fillna(0).astype('int')
training_data['usagequantity'] = (
    pd.to_numeric(training_data['usagequantity'],
                  errors='coerce')
      .fillna(0)
    )

Comments

Submit
0 Comments