In my data frame there are two columns and they are obj type.
| index | COLOUR | CATEGORY |
|---|---|---|
| 0 | blue | iphone11 |
| 1 | black | iphone12 |
iphone_sale['COLOUR'] = iphone_sale['COLOUR'].astype(str)
iphone_sale['CATEGORY'] = iphone_sale['CATEGORY'].astype(str)
I need to create a new column using above both columns.
iphone_sales_sum["colour_category"] = iphone_sales_sum.apply(lambda x: f"{x['COLOUR']} /{x['CATEGORY']}", axis=1)
But I am getting a noisy values as the derived column.
iphone 12\nName: 0, dtype: object/... etc
But it doesn't give any error i lmbda function.This code perfectly worked for an other scenario.