I've got a numpy array that looks like this, in general (it was created from a pd crosstable if that's of any significance)
Person | 1to1 Person Attribute | Circumstance | Outcome A Count | Outcome B Count |
---|---|---|---|---|
ABC1 | 1 | X | 100 | 25 |
DEF2 | 2 | X | 1 | 2 |
Y | 0 | 2 | ||
XYZ1 | 1 | X | 33 | 5 |
Y | 5 | 10 |
that I'd like to turn into a pandas dataframe that looks like
Person | 1to1 Person Attribute | Circumstance | Outcome A Count | Outcome B Count |
---|---|---|---|---|
ABC1 | 1 | X | 100 | 25 |
DEF2 | 2 | X | 1 | 2 |
DEF2 | 2 | Y | 0 | 2 |
XYZ1 | 1 | X | 33 | 5 |
XYZ1 | 1 | Y | 5 | 10 |
I've attempted some for loops to take any situation where there's a blank and replace it with the previously observed value, but I've hit such an array of errors I've decided I might be headed down the wrong path entirely.
Thank you, everybody