I have a csv that has several columns. I need the middle columns to be merged into one column seperated by pipes
How would i go about doing that that?
Example Data:
B032CN517,TRUE,Men's 4.2 oz. Long-Sleeve Henley,"""1151|0|5"";""994|6|47"";""964|48|-1"";",0.47,Broder,3150,,22.60,2XL,0,BLACK,Canvas,,,B032CN517,http://www.broderbros.com/images/bro/prodDetail/3150_51_p.jpg,Apparel,Activewear,Henleys & Jerseys
Desired output
B032CN517,TRUE,Men's 4.2 oz. Long-Sleeve Henley,"""1151|0|5"";""994|6|47"";""964|48|-1"";",0.47,Broder,3150,,22.60,2XL,0,BLACK,Canvas,,,B032CN517,http://www.broderbros.com/images/bro/prodDetail/3150_51_p.jpg,Apparel|Activewear|Henleys & Jerseys
I assume you’ll use the CSV module to read in that line, which will give a list of all the comma-delimited items in that line.
Then it’s very simple: