So, I've seen this answer here, which is sensible for functions which return one output. What if my function has multiple outputs?
More concretely, let's say I am cross-referencing some data on some ID. But when I call certain IDs, it returns multiple matches, which I want to put into different columns.
An example of this would be something like the below, where worker 3 has two bosses, 0
and 2
, while worker 1
has one boss, 2
.
Worker_ID Boss_ID
3 0
3 2
1 2
Is it possible to create the second column and populate without first going through, counting the number of matches and creating the relevant number of columns?
EDIT:
I'd like something like this in short-form:
Worker_ID Boss_ID_1 Boss_ID_2 ...as necessary
3 0 2
1 2 nan