Columns Types, .assign, and Memory Usage
Explore updating columns, creating columns, and changing the types of columns.
Conversion methods
There are various methods and functions for changing the types of a Series in pandas. We can call astype
to update column types. Or we can use the assign
method to return a new DataFrame with the updated type.
The astype
method allows us to specify the types of each column with a dictionary.
The assign
method is a key method to master. We specify the name of a column with a keyword argument. If the argument name is an existing column, it will ...