I have search far and wide for an example of how to edit / rewrite a CSV based on some simple conditions and some string concatenation. I realised that it may have to be written into a new CSV and this is fine.
Here’s the format of the CSV with some fake data
FlatNumber FirstName Surname Email
1 Darth Vader email@example.com
1.1 Luke Skywalker firstname.lastname@example.org
2 Ben Kinobe email@example.com
2.1 Leia Organa Leia.Organa@madeup.domain
2.2 Han Solo firstname.lastname@example.org
3 Jabba Hutt email@example.com
3.1 Lando Calrissian firstname.lastname@example.org
3.2 Wedge Antilles email@example.com
4 Emperor Palpatine firstname.lastname@example.org
4.1 Mon Mothma email@example.com
5 C- 3PO C-3PO@madeup.domain
What I’d like to do is delete certain emails by looping through and comparing to a string array? Say you always wanted to remove firstname.lastname@example.org & email@example.com
The next thing I’d like to do would be to merge flat number, firstname, surname and concatenate them “add flat"flatnumber firstname”." surname “@madeup.com” resulting in
add flat1 firstname.lastname@example.org
For various reasons I can’t use Pandas to achieve this and wondered if Python could do it without add-on functionality.
Thanks in advance for any guidance!