change dtype to int pandas code example
Example 1: python: transform as type numeirc
df['myvar'] = df['myvar'].astype(str) # Transform as character
df['myvar'] = df['myvar'].astype(float) # Transform as float
df['myvar'] = df['myvar'].astype(int) # Transform as numeric
Example 2: change dataframe column type
>>> df.astype({'col1': 'int32'}).dtypes
col1 int32
col2 int64
dtype: object