Q19: Which contestant(s) played a perfect game? A perfect game is considered when the contestant:

didn't receive any tribal council votes all season (this is different than Q10 since some players played multiple times. They got voted out in one season so they would not show in Q10 but they came back for another season and didn't receive any tribal council votes)
won the game
got unanimous jury votes (see question 12)
Save this DataFrame as Q19 with the following columns: season_name, season, castaway_id, full_name, tribal_council_votes, jury_votes. The DataFrame should be sorted by season and the index should be 0 to n-1.

1 answer

To create DataFrame Q19 with the required columns and sort it accordingly, we can follow these steps:

1. Select the subset of the DataFrame (named 'survivor_data') where the 'won' column is True.
2. Filter the resulting DataFrame by checking both the 'unanimous_jury_votes' and 'tribal_council_votes' columns are equal to zero.
3. Sort the filtered DataFrame by the 'season' column.
4. Create a new DataFrame (named 'Q19') with the desired columns 'season_name', 'season', 'castaway_id', 'full_name', 'tribal_council_votes', and 'jury_votes'.
5. Set the index of the DataFrame 'Q19' to range from 0 to n-1.

Here's the code that accomplishes these steps:

``` python
Q19 = survivor_data[(survivor_data['won']) &
(survivor_data['unanimous_jury_votes'] == 1) &
(survivor_data['tribal_council_votes'] == 0)].sort_values('season')

Q19 = Q19[['season_name', 'season', 'castaway_id', 'full_name', 'tribal_council_votes', 'jury_votes']]
Q19.reset_index(drop=True, inplace=True)
```

The resulting DataFrame, Q19, will have the required columns, sorted by season and with the index range set from 0 to n-1.