Let's say I had a dictionary of arrays, eg:
favourite_icecreams = {
'Josh': ['vanilla', 'banana'],
'Greg': ['chocolate'],
'Sarah': ['mint', 'vanilla', 'mango']
}
I want to convert it to a pandas dataframe, with columns as "Flavour" and "Person". It should look like this:
| Flavour | Person |
|---|---|
| vanilla | Josh |
| banana | Josh |
| chocolate | Greg |
| mint | Sarah |
| vanilla | Sarah |
| mango | Sarah |
What's the most efficient way to do this?