I have a dataframe that looks like this:
Friend A Friend B Score
0 Walter John 22
1 Walter Jack 32
2 Fred John 10
3 Caleb Jack 5
What I'd like to produce is this:
{"Walter": {"John": 22, "Jack": 32}, "Fred": {"John": 10}, "Caleb": {"Jack": 5}}
What I have so far is this:
x = Network.groupby("Friend A")[["Friend A", "Friend B", "Score"]]
I've tried doing the following:
x.apply(list).to_dict()
But this isn't the result I'd like to get. How can I achieve this result?