Skip to content
Advertisement

Python – Trouble printing to CSV

My code seems to be outputting the list I want, however, when I try printing the list to CSV I do not get the same result on the .csv file for some reason. I am sure there’s something not right at the end of my code. Could anyone please shed some light? Thanks in advance.

JavaScript

Advertisement

Answer

I have not used pandas before. But it looks like you are outputting to csv the original microRuleSet-row.csv that you loaded. You have to export the deduplicated_list to csv. OK so each row must have no duplicated items. This code will do that. The first (header) row is now numbered 0 to 5. This can be changed to to the original heading, and adding placeholders for the extra empty csv cells.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement