python typecast int code example Example 1: python cast to float float('1.234') Example 2: python: convert variable as character df['myvar'] = df['myvar'].astype(str)