Reputation:
My data set is below
Name,ID
Ma,22
Hu,33
My code its adding all lines and going through next line, its not fine
data['New_Name'] = data['Name'] + str(data_final_x['ID'])
Expected out
Name,ID,New_Name
Ma,22,Ma 22
Hu,33,Hu 22
Upvotes: 0
Views: 13
Reputation: 150785
str(series)
returns representation of the whole series. You want
data['New_Name'] = data['Name'] + ' ' + data['ID'].astype(str)
Upvotes: 1