i have this txt and want to change the dtypes of ID,Foo,Bla,Bar,Timestamp
. For example i want to change ID to int64
. How can i do that?
ID Foo Bla Bar Timestamp
1 21.07 NaN 2020-15-04
2 22.07 NaN 2005-01-05
3 22.05 Baz 1970-01-01
i have this txt and want to change the dtypes of ID,Foo,Bla,Bar,Timestamp
. For example i want to change ID to int64
. How can i do that?
ID Foo Bla Bar Timestamp
1 21.07 NaN 2020-15-04
2 22.07 NaN 2005-01-05
3 22.05 Baz 1970-01-01
Assuming that you've read the txt file into a dataframe and the column with ID in it is called "ID" you can cast that column to an int64.
import numpy as np
df.astype({'ID': np.int64})
This can help if you want more resources for converting dataframe types.