Reputation: 139
I have the following dataframe:
col1 01 1 02 2 03 3 00 0
How can I replace values in col1 to be like the expected output below:
Expected Output:
col1 1 1 2 2 3 3 0 0
Upvotes: 0
Views: 55
Reputation: 493
df['col1'] = df['col1'].map(int)
Reputation: 316
You can do it like this:
df['col1'] = df['col1'].astype('int')
Upvotes: 1
Reputation: 921
Can you try this?
df['col1']=[int(x) for x in df['col1']]