jeudi 14 juillet 2016

Merging CSV Rows with Common Data and Updating Count

I have a CSV with data like the following:

document_id | body_mention | count

doc_01 | Bob | 5

doc_03 | Sam | 1

doc_04 | Bob | 1

Where body_mention are names parsed out from text and count is how many times that name appeared in a certain document (document_id). So, Bob appeared 5 times in doc_01.

However, I want my CSV to update so that an occurrence of Bob will simply update the previous Bob entry, so the new update looks like:

document_id | body_mention | count

doc_01, doc_04 | Bob | 6

doc_03 | Sam | 1

Any ideas how I could start scripting this up?

Aucun commentaire:

Enregistrer un commentaire