(Actual input CSV is comma-delimited as normal; I just showed my ideas as tables for ease of viewing.)
Here's an example of what I want to do using Python 2.7 (Pandas if it's better/easier, but I also like learning python logic and pandas skips over a lot, though I may have to learn it for stuff like this):
From
Price Name Text Number Choice URL Email
$40 Foo Stuff 560 Y www.a.com [email protected]
$60 Foo Things 280 N www.a.com [email protected]
$20 Foo Other 120 Y www.a.com [email protected]
$25 John Gals 1222 N www.b.com [email protected]
$100 Bar Dudes 999 Y www.c.com [email protected]
$250 Bar Guys 200 Y www.c.com [email protected]
To
Name Price1 Price2 Price3 Text1 Text2 Text3 Number1 Number2 Number3 Choice1 Choice2 Choice3 URL Email
Foo $40 $60 $20 Stuff Things Other 560 280 120 Y N Y www.a.com [email protected]
John $25 Gals 1222 N www.b.com [email protected]
Bar $100 $250 Dudes Guys 999 200 Y Y www.c.com [email protected]
The order of the columns doesn't matter, though I would like to combine by the name column as a rule. (Hopefully I got them right, as just the example was a pain!)
For extra credit, I'd love to stop a cell from populating a new column if it's blank: e.g. if [email protected] was missing from row 2 in From above, To would look the same, not spawn a "Email2" column. Also, while the order of columns doesn't matter (I'm using this to populate a database that requires CSV input), the numbering has to match up! That is, for any given name, e.g. Foo above: $60, Things, 280, and N all have to be in columns marked "[OrigName]2" - and no Column2 should be populated while a column1 is blank for any given label.
This should be easy, but for completeness, I also need a column that adds up the filled Text columns (e.g., integer column "Number of Texts") and another one that adds up the number of "Price"s marked "Free" (e.g., "Number of Free Texts").
Thanks so much for any help - I'm already excited for what I'll learn from this, and further reading resources are always welcome!
zip(*matrix)