I have a dataframe containing address info such that
df
streetNumber streetName province postalCode
120 ABC AVE A 121345
20 ACD Street A 231345
21 QWE AVE B 234912
6 WDS Road C 212344
I want to join these four columns into a single column called address to hold all address info at once. I use the following loop to join columns, but how can I insert the value in to the address column?
for index, row in df.iterrows():
# try statements let us attempt something.
try:
address = ' '.join([row['streetNumber'], row['streetName'],
row['province'], row['postalCode']])
Expected output
streetNumber streetName province postalCode address
120 ABC AVE A 121345 120 ABC AVE A 121345
20 ACD Street A 231345 20 ACD Street A 231345
21 QWE AVE B 234912 21 QWE AVE B 234912
6 WDS Road C 212344 6 WDS Road C 212344