One approach will be used [:]to perform assignment on all columns and with the help iloc[:,[1]]to select col-1, keeping the format of the column -
df[:] = df.iloc[:,[1]]
Run Example -
In [15]: df
Out[15]:
0 1 2 3 4
0 a b c d e
1 f g h i j
2 k l m n o
3 p q r s t
In [16]: df[:] = df.iloc[:,[1]]
In [17]: df
Out[17]:
0 1 2 3 4
0 b b b b b
1 g g g g g
2 l l l l l
3 q q q q q
Handling dtype mixed digital frames
, , -1, , 'object' dtype, . , -
df = df.astype('object')
df[:] = df.iloc[:,[1]]
-
In [267]: df = pd.DataFrame(index=range(5), columns=range(10))
...: S = pd.Series(np.random.randint(0,9,(18)))
...: df[1] = S
...:
In [268]: df
Out[268]:
0 1 2 3 4 5 6 7 8 9
0 NaN 3 NaN NaN NaN NaN NaN NaN NaN NaN
1 NaN 3 NaN NaN NaN NaN NaN NaN NaN NaN
2 NaN 1 NaN NaN NaN NaN NaN NaN NaN NaN
3 NaN 0 NaN NaN NaN NaN NaN NaN NaN NaN
4 NaN 6 NaN NaN NaN NaN NaN NaN NaN NaN
In [269]: df = df.astype('object')
...: df[:] = df.iloc[:,[1]]
...:
In [270]: df
Out[270]:
0 1 2 3 4 5 6 7 8 9
0 3 3 3 3 3 3 3 3 3 3
1 3 3 3 3 3 3 3 3 3 3
2 1 1 1 1 1 1 1 1 1 1
3 0 0 0 0 0 0 0 0 0 0
4 6 6 6 6 6 6 6 6 6 6