Knowledge is the Only Good
  • About

Effective Python: Converting Datatypes in Pandas

programming
Python
effective python
Author

Stephen J. Mildenhall

Published

2022-03-01

Series method astype it is already a number and you want to change the type. Will not coerce.

pd methods - have coerce - generally what you want, e.g., non floats to nan rather than have method fail.

to_datetime : Convert argument to datetime. to_timedelta : Convert argument to timedelta. to_numeric : Convert argument to a numeric type.

Stephen J. Mildenhall. License: CC BY-SA 2.0.

 

Website made with Quarto