I am looking for the logic to concatenate the values in many columns with related data from an .xlsx file into a single column using pandas in python. The logic to combine each different column would be different depending on what information the column contains. For example:
input:
ID,when_carpool,smoking,vehicle,passengers
0,weekdays,yes,truck,3
1,weekends,no,sedan,4
2,weekdays,no,van,6
3,weekdays,no,van,5
4,weekends,yes,sedan,3
I have thousands of these rows to process, note that I want to transform the value of the 'smoking' column so it's not a simple concatenation of all columns.
output:
ID,carpool_info
0,weekdays+smoking+truck+3
1,weekends+nonsmoking+sedan+4
2,weekdays+nonsmoking+van+6
3,weekdays+nonsmoking+van+5
4,weekends+smoking+sedan+3