So, I have the following dataframe in Pandas:
| Name | Sport | Age |
|---|---|---|
| Mary | Soccer | 20 |
| Ronald | Basketball | 31 |
| Mary | Rugby | 20 |
| Ronald | Tennis | 31 |
| Ronald | Golf | 31 |
| Jennifer | Tennis | 18 |
| Jennifer | Soccer | 18 |
And just like I could do in SQL, I need to isolate the unique names the unique sports. However, each unique sport must become a column, so I can display how many times it appeared, like this:
| Name | Soccer | Basketball | Rugby | Tennis | Golf |
|---|---|---|---|---|---|
| Mary | 1 | 0 | 1 | 0 | 0 |
| Ronald | 0 | 1 | 0 | 1 | 1 |
| Jennifer | 1 | 0 | 0 | 1 | 0 |
I'm completely lost and don't know how to solve that. Could someone help me, please?