python to strring code example Example 1: to string python x = 2.718 strX = str(x) Example 2: python: convert variable as character df['myvar'] = df['myvar'].astype(str)