I have a dataset that looks like that:
true_time amount name value fruit
2019-11-28 12:57:00 0.59 AAA 81.98 apple
2019-11-28 12:58:00 2.37 BBB 261.98 orange
2019-11-28 12:59:00 559.4 CCC 71.45 banana
I'm trying to add an extra column to the end called concat
which should contain a string of joined values from certain cells on the same row.
The result looks like this:
... fruit concat
apple 0.59-AAA-81.98
orange 2.37-BBB-261.98
banana 559.4-CCC-71.45
I tried bits and pieces but was not sure how to access multiple cells per row and ended up with this incomplete attempt.
df['concat'] = df['concat'].apply(lambda x: '{}-{}-{}'.format(loc[0], loc[1], loc[2]))
I might be needing a standalone function as I'm planning to hash the string and add the result to a hash
column next to the concat
column.