I'm working with the data from the Veris project through VerisPy and having some trouble reformatting it for use in other applications.
VerisPy outputs a dataframe containing parsed event information from the JSON files submitted to Veris. Each row in the dataframe corresponds to an event, with details about how/when it occurred. The problem is that it ends up with thousands of columns with boolean flags.
So each event row might have columns like:
| event_id | action.malware | action.hacking | action.misuse | actor.external.competitor | actor.external.crime | actor.internal.employee | actor.internal.customer | target |
|---|---|---|---|---|---|---|---|---|
| 1 | True | False | False | False | False | True | False | Microsoft |
| 2 | False | True | False | True | False | False | False | Bank of America |
I'd like to collapse/combine these and use the column values as the actual data. In the example above, that might end us as:
| event_id | Action | Actor | target |
|---|---|---|---|
| 1 | Malware | Internal - Employee | Microsoft |
| 2 | Hacking | External - Competitor | Bank of America |
I'm new to Pandas but have tried a fair amount of things from the documentation with mixed results. Melt seemed promising, but I'm unsure how to get the column names into the actual row-level data. Does anyone have pointers?