I have a pandas dataframe like the following. I created the last 3 columns based on unique values from the column RefIDPrefix.
| RefIDPrefix | RefIDNumber | GO | PMID | Reactome |
|---|---|---|---|---|
| GO | 12345 | |||
| PMID | 23456 | |||
| Reactome | 34567 | |||
| GO | 45678 | |||
| GO | 56789 | |||
| PMID | 67890 |
I want to fill the last 3 columns like the following. Basically, based on the value in RefIDPrefix, I want to take the value in RefIDNumber and put it in the correct column corresponding to RefIDPrefix.
| RefIDPrefix | RefIDNumber | GO | PMID | Reactome |
|---|---|---|---|---|
| GO | 12345 | 12345 | ||
| PMID | 23456 | 23456 | ||
| Reactome | 34567 | 34567 | ||
| GO | 45678 | 45678 | ||
| GO | 56789 | 56789 | ||
| PMID | 67890 | 67890 |
I have been trying to do this for a while but haven't been able to figure out how to go about it. Any help would be appreciated!