Reputation: 460
I have integer column in dataframe.
dt.Values.dtypes
dtype('int64')
Input
Df.Values
1234
34567
2344
1234
1222
Expected output
('1234','34567','2344','1234','1222')
How can this be done
Upvotes: 2
Views: 40
Reputation: 863166
Convert values to strings and then to tuple:
out = tuple(dt.Values.astype(str))
Or:
out = tuple(map(str, dt.Values))
#alternative
#out = tuple([str(x) for x in dt.Values])
print (out)
('1234', '34567', '2344', '1234', '1222')
If want string separated by ,
:
out1 = ', '.join(dt.Values.astype(str))
print (out1)
1234, 34567, 2344, 1234, 1222
Upvotes: 2