xxxxxxxxxx
import pandas as pd
# Create a sample dataframe
data = {'Integer': [1, 2, 3, 4, 5]}
df = pd.DataFrame(data)
# Convert the 'Integer' column to string type using astype function
df['Integer'] = df['Integer'].astype(str)
# Print the dataframe
print(df)
xxxxxxxxxx
df['column'] = df['column'].astype('|S80') #where the max length is set at 80 bytes,
xxxxxxxxxx
import pandas as pd
# Create a sample DataFrame
data = {'Name': ['John', 'Sam', 'Emily'],
'Age': [25, 30, 35],
'Score': [90.5, 85.25, 95.75]}
df = pd.DataFrame(data)
# Convert 'Score' column to string
df['Score'] = df['Score'].astype(str)
print(df.dtypes)