I have few data frame columns.
colnames = ['dot0', 'dot1', 'dot2', 'dot3', 'dot4', 'dot5']
Their values must be joined with a "." to form a new column named "Connected". I have used map to do it as shown below:
df["Connected"] =df['dot0'].map(str) + '.' + df['dot1'].map(str) + '.' + df['dot2'].map(str) + '.' + df['dot3'].map(str) + '.' + df['dot4'].map(str) + '.' + df['dot5'].map(str)
But, is there a simpler way where I can join by looping through the values columns.
Something like:
for i in colnames:
df[i].map