我有一个包含这两列的数据框:
recipe_item_qty-> 3个adet orta男孩,4个yemekkaşığı,1个çaykaşığı
recipe_item_name-> patates,zeytinyağı,karabiber
我要实现的目标是:
recipe_qty_with_name-> 3个adet orta男孩拍拍,4个yemekkaşığızeytinyağ,1个çaykaşığıkarabiber
我尝试用以下2个不同的代码段压缩列:
detail_csv_df['recipe_qty_with_name'] = list(zip(detail_csv_df.recipe_item_qty, detail_csv_df.recipe_item_name))
detail_csv_df['recipe_qty_with_name_2'] = detail_csv_df[['recipe_item_qty', 'recipe_item_name']].apply(tuple, axis=1)
这就是这些的结果
recipe_qty_with_name->('3 adet orta boy,4 yemekkaşığı,1çaykaşığı','patates,zeytinyağı,karabiber')