Type Conversion
Learn how to convert between types in pandas.
We'll cover the following...
Why should we care about type?
- Reduce memory usage: Generally speaking, the numerical value would be regarded as
float64
orint64
. In most cases, this is OK. However, imagine you have, say, 50 million rows, but the columns will only store numbers from 0 to 20.int8
is quite enough in this case and saves a lot of memory. - Unmatched type: As mentioned above, the numerical value would be regarded as