{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "star_wars = pd.read_csv(\"star_wars.csv\", encoding=\"ISO-8859-1\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>RespondentID</th>\n",
       "      <th>Have you seen any of the 6 films in the Star Wars franchise?</th>\n",
       "      <th>Do you consider yourself to be a fan of the Star Wars film franchise?</th>\n",
       "      <th>Which of the following Star Wars films have you seen? Please select all that apply.</th>\n",
       "      <th>Unnamed: 4</th>\n",
       "      <th>Unnamed: 5</th>\n",
       "      <th>Unnamed: 6</th>\n",
       "      <th>Unnamed: 7</th>\n",
       "      <th>Unnamed: 8</th>\n",
       "      <th>Please rank the Star Wars films in order of preference with 1 being your favorite film in the franchise and 6 being your least favorite film.</th>\n",
       "      <th>...</th>\n",
       "      <th>Unnamed: 28</th>\n",
       "      <th>Which character shot first?</th>\n",
       "      <th>Are you familiar with the Expanded Universe?</th>\n",
       "      <th>Do you consider yourself to be a fan of the Expanded Universe?</th>\n",
       "      <th>Do you consider yourself to be a fan of the Star Trek franchise?</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Age</th>\n",
       "      <th>Household Income</th>\n",
       "      <th>Education</th>\n",
       "      <th>Location (Census Region)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>3292879998</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Star Wars: Episode I  The Phantom Menace</td>\n",
       "      <td>Star Wars: Episode II  Attack of the Clones</td>\n",
       "      <td>Star Wars: Episode III  Revenge of the Sith</td>\n",
       "      <td>Star Wars: Episode IV  A New Hope</td>\n",
       "      <td>Star Wars: Episode V The Empire Strikes Back</td>\n",
       "      <td>Star Wars: Episode VI Return of the Jedi</td>\n",
       "      <td>3.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Very favorably</td>\n",
       "      <td>I don't understand this question</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>NaN</td>\n",
       "      <td>High school degree</td>\n",
       "      <td>South Atlantic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>3292879538</td>\n",
       "      <td>No</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$0 - $24,999</td>\n",
       "      <td>Bachelor degree</td>\n",
       "      <td>West South Central</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3292765271</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>Star Wars: Episode I  The Phantom Menace</td>\n",
       "      <td>Star Wars: Episode II  Attack of the Clones</td>\n",
       "      <td>Star Wars: Episode III  Revenge of the Sith</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Unfamiliar (N/A)</td>\n",
       "      <td>I don't understand this question</td>\n",
       "      <td>No</td>\n",
       "      <td>NaN</td>\n",
       "      <td>No</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$0 - $24,999</td>\n",
       "      <td>High school degree</td>\n",
       "      <td>West North Central</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3292763116</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Star Wars: Episode I  The Phantom Menace</td>\n",
       "      <td>Star Wars: Episode II  Attack of the Clones</td>\n",
       "      <td>Star Wars: Episode III  Revenge of the Sith</td>\n",
       "      <td>Star Wars: Episode IV  A New Hope</td>\n",
       "      <td>Star Wars: Episode V The Empire Strikes Back</td>\n",
       "      <td>Star Wars: Episode VI Return of the Jedi</td>\n",
       "      <td>5.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Very favorably</td>\n",
       "      <td>I don't understand this question</td>\n",
       "      <td>No</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$100,000 - $149,999</td>\n",
       "      <td>Some college or Associate degree</td>\n",
       "      <td>West North Central</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>3292731220</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Star Wars: Episode I  The Phantom Menace</td>\n",
       "      <td>Star Wars: Episode II  Attack of the Clones</td>\n",
       "      <td>Star Wars: Episode III  Revenge of the Sith</td>\n",
       "      <td>Star Wars: Episode IV  A New Hope</td>\n",
       "      <td>Star Wars: Episode V The Empire Strikes Back</td>\n",
       "      <td>Star Wars: Episode VI Return of the Jedi</td>\n",
       "      <td>5.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Somewhat favorably</td>\n",
       "      <td>Greedo</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$100,000 - $149,999</td>\n",
       "      <td>Some college or Associate degree</td>\n",
       "      <td>West North Central</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 38 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   RespondentID Have you seen any of the 6 films in the Star Wars franchise?  \\\n",
       "0    3292879998                                                Yes             \n",
       "1    3292879538                                                 No             \n",
       "2    3292765271                                                Yes             \n",
       "3    3292763116                                                Yes             \n",
       "4    3292731220                                                Yes             \n",
       "\n",
       "  Do you consider yourself to be a fan of the Star Wars film franchise?  \\\n",
       "0                                                Yes                      \n",
       "1                                                NaN                      \n",
       "2                                                 No                      \n",
       "3                                                Yes                      \n",
       "4                                                Yes                      \n",
       "\n",
       "  Which of the following Star Wars films have you seen? Please select all that apply.  \\\n",
       "0           Star Wars: Episode I  The Phantom Menace                                    \n",
       "1                                                NaN                                    \n",
       "2           Star Wars: Episode I  The Phantom Menace                                    \n",
       "3           Star Wars: Episode I  The Phantom Menace                                    \n",
       "4           Star Wars: Episode I  The Phantom Menace                                    \n",
       "\n",
       "                                    Unnamed: 4  \\\n",
       "0  Star Wars: Episode II  Attack of the Clones   \n",
       "1                                          NaN   \n",
       "2  Star Wars: Episode II  Attack of the Clones   \n",
       "3  Star Wars: Episode II  Attack of the Clones   \n",
       "4  Star Wars: Episode II  Attack of the Clones   \n",
       "\n",
       "                                    Unnamed: 5  \\\n",
       "0  Star Wars: Episode III  Revenge of the Sith   \n",
       "1                                          NaN   \n",
       "2  Star Wars: Episode III  Revenge of the Sith   \n",
       "3  Star Wars: Episode III  Revenge of the Sith   \n",
       "4  Star Wars: Episode III  Revenge of the Sith   \n",
       "\n",
       "                          Unnamed: 6  \\\n",
       "0  Star Wars: Episode IV  A New Hope   \n",
       "1                                NaN   \n",
       "2                                NaN   \n",
       "3  Star Wars: Episode IV  A New Hope   \n",
       "4  Star Wars: Episode IV  A New Hope   \n",
       "\n",
       "                                     Unnamed: 7  \\\n",
       "0  Star Wars: Episode V The Empire Strikes Back   \n",
       "1                                           NaN   \n",
       "2                                           NaN   \n",
       "3  Star Wars: Episode V The Empire Strikes Back   \n",
       "4  Star Wars: Episode V The Empire Strikes Back   \n",
       "\n",
       "                                 Unnamed: 8  \\\n",
       "0  Star Wars: Episode VI Return of the Jedi   \n",
       "1                                       NaN   \n",
       "2                                       NaN   \n",
       "3  Star Wars: Episode VI Return of the Jedi   \n",
       "4  Star Wars: Episode VI Return of the Jedi   \n",
       "\n",
       "   Please rank the Star Wars films in order of preference with 1 being your favorite film in the franchise and 6 being your least favorite film.  \\\n",
       "0                                                3.0                                                                                               \n",
       "1                                                NaN                                                                                               \n",
       "2                                                1.0                                                                                               \n",
       "3                                                5.0                                                                                               \n",
       "4                                                5.0                                                                                               \n",
       "\n",
       "   ...         Unnamed: 28       Which character shot first?  \\\n",
       "0  ...      Very favorably  I don't understand this question   \n",
       "1  ...                 NaN                               NaN   \n",
       "2  ...    Unfamiliar (N/A)  I don't understand this question   \n",
       "3  ...      Very favorably  I don't understand this question   \n",
       "4  ...  Somewhat favorably                            Greedo   \n",
       "\n",
       "   Are you familiar with the Expanded Universe?  \\\n",
       "0                                           Yes   \n",
       "1                                           NaN   \n",
       "2                                            No   \n",
       "3                                            No   \n",
       "4                                           Yes   \n",
       "\n",
       "   Do you consider yourself to be a fan of the Expanded Universe?  \\\n",
       "0                                                 No                \n",
       "1                                                NaN                \n",
       "2                                                NaN                \n",
       "3                                                NaN                \n",
       "4                                                 No                \n",
       "\n",
       "   Do you consider yourself to be a fan of the Star Trek franchise? Gender  \\\n",
       "0                                                 No                  Male   \n",
       "1                                                Yes                  Male   \n",
       "2                                                 No                  Male   \n",
       "3                                                Yes                  Male   \n",
       "4                                                 No                  Male   \n",
       "\n",
       "     Age     Household Income                         Education  \\\n",
       "0  18-29                  NaN                High school degree   \n",
       "1  18-29         $0 - $24,999                   Bachelor degree   \n",
       "2  18-29         $0 - $24,999                High school degree   \n",
       "3  18-29  $100,000 - $149,999  Some college or Associate degree   \n",
       "4  18-29  $100,000 - $149,999  Some college or Associate degree   \n",
       "\n",
       "  Location (Census Region)  \n",
       "0           South Atlantic  \n",
       "1       West South Central  \n",
       "2       West North Central  \n",
       "3       West North Central  \n",
       "4       West North Central  \n",
       "\n",
       "[5 rows x 38 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "star_wars.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['RespondentID',\n",
       "       'Have you seen any of the 6 films in the Star Wars franchise?',\n",
       "       'Do you consider yourself to be a fan of the Star Wars film franchise?',\n",
       "       'Which of the following Star Wars films have you seen? Please select all that apply.',\n",
       "       'Unnamed: 4', 'Unnamed: 5', 'Unnamed: 6', 'Unnamed: 7', 'Unnamed: 8',\n",
       "       'Please rank the Star Wars films in order of preference with 1 being your favorite film in the franchise and 6 being your least favorite film.',\n",
       "       'Unnamed: 10', 'Unnamed: 11', 'Unnamed: 12', 'Unnamed: 13',\n",
       "       'Unnamed: 14',\n",
       "       'Please state whether you view the following characters favorably, unfavorably, or are unfamiliar with him/her.',\n",
       "       'Unnamed: 16', 'Unnamed: 17', 'Unnamed: 18', 'Unnamed: 19',\n",
       "       'Unnamed: 20', 'Unnamed: 21', 'Unnamed: 22', 'Unnamed: 23',\n",
       "       'Unnamed: 24', 'Unnamed: 25', 'Unnamed: 26', 'Unnamed: 27',\n",
       "       'Unnamed: 28', 'Which character shot first?',\n",
       "       'Are you familiar with the Expanded Universe?',\n",
       "       'Do you consider yourself to be a fan of the Expanded Universe?',\n",
       "       'Do you consider yourself to be a fan of the Star Trek franchise?',\n",
       "       'Gender', 'Age', 'Household Income', 'Education',\n",
       "       'Location (Census Region)'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "star_wars.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>RespondentID</th>\n",
       "      <th>Have you seen any of the 6 films in the Star Wars franchise?</th>\n",
       "      <th>Do you consider yourself to be a fan of the Star Wars film franchise?</th>\n",
       "      <th>Which of the following Star Wars films have you seen? Please select all that apply.</th>\n",
       "      <th>Unnamed: 4</th>\n",
       "      <th>Unnamed: 5</th>\n",
       "      <th>Unnamed: 6</th>\n",
       "      <th>Unnamed: 7</th>\n",
       "      <th>Unnamed: 8</th>\n",
       "      <th>Please rank the Star Wars films in order of preference with 1 being your favorite film in the franchise and 6 being your least favorite film.</th>\n",
       "      <th>...</th>\n",
       "      <th>Unnamed: 28</th>\n",
       "      <th>Which character shot first?</th>\n",
       "      <th>Are you familiar with the Expanded Universe?</th>\n",
       "      <th>Do you consider yourself to be a fan of the Expanded Universe?</th>\n",
       "      <th>Do you consider yourself to be a fan of the Star Trek franchise?</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Age</th>\n",
       "      <th>Household Income</th>\n",
       "      <th>Education</th>\n",
       "      <th>Location (Census Region)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>3292879998</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>Star Wars: Episode I  The Phantom Menace</td>\n",
       "      <td>Star Wars: Episode II  Attack of the Clones</td>\n",
       "      <td>Star Wars: Episode III  Revenge of the Sith</td>\n",
       "      <td>Star Wars: Episode IV  A New Hope</td>\n",
       "      <td>Star Wars: Episode V The Empire Strikes Back</td>\n",
       "      <td>Star Wars: Episode VI Return of the Jedi</td>\n",
       "      <td>3.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Very favorably</td>\n",
       "      <td>I don't understand this question</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>NaN</td>\n",
       "      <td>High school degree</td>\n",
       "      <td>South Atlantic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>3292879538</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$0 - $24,999</td>\n",
       "      <td>Bachelor degree</td>\n",
       "      <td>West South Central</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3292765271</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>Star Wars: Episode I  The Phantom Menace</td>\n",
       "      <td>Star Wars: Episode II  Attack of the Clones</td>\n",
       "      <td>Star Wars: Episode III  Revenge of the Sith</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Unfamiliar (N/A)</td>\n",
       "      <td>I don't understand this question</td>\n",
       "      <td>No</td>\n",
       "      <td>NaN</td>\n",
       "      <td>No</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$0 - $24,999</td>\n",
       "      <td>High school degree</td>\n",
       "      <td>West North Central</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3292763116</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>Star Wars: Episode I  The Phantom Menace</td>\n",
       "      <td>Star Wars: Episode II  Attack of the Clones</td>\n",
       "      <td>Star Wars: Episode III  Revenge of the Sith</td>\n",
       "      <td>Star Wars: Episode IV  A New Hope</td>\n",
       "      <td>Star Wars: Episode V The Empire Strikes Back</td>\n",
       "      <td>Star Wars: Episode VI Return of the Jedi</td>\n",
       "      <td>5.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Very favorably</td>\n",
       "      <td>I don't understand this question</td>\n",
       "      <td>No</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$100,000 - $149,999</td>\n",
       "      <td>Some college or Associate degree</td>\n",
       "      <td>West North Central</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>3292731220</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>Star Wars: Episode I  The Phantom Menace</td>\n",
       "      <td>Star Wars: Episode II  Attack of the Clones</td>\n",
       "      <td>Star Wars: Episode III  Revenge of the Sith</td>\n",
       "      <td>Star Wars: Episode IV  A New Hope</td>\n",
       "      <td>Star Wars: Episode V The Empire Strikes Back</td>\n",
       "      <td>Star Wars: Episode VI Return of the Jedi</td>\n",
       "      <td>5.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Somewhat favorably</td>\n",
       "      <td>Greedo</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$100,000 - $149,999</td>\n",
       "      <td>Some college or Associate degree</td>\n",
       "      <td>West North Central</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 38 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   RespondentID  Have you seen any of the 6 films in the Star Wars franchise?  \\\n",
       "0    3292879998                                               True              \n",
       "1    3292879538                                              False              \n",
       "2    3292765271                                               True              \n",
       "3    3292763116                                               True              \n",
       "4    3292731220                                               True              \n",
       "\n",
       "  Do you consider yourself to be a fan of the Star Wars film franchise?  \\\n",
       "0                                               True                      \n",
       "1                                                NaN                      \n",
       "2                                              False                      \n",
       "3                                               True                      \n",
       "4                                               True                      \n",
       "\n",
       "  Which of the following Star Wars films have you seen? Please select all that apply.  \\\n",
       "0           Star Wars: Episode I  The Phantom Menace                                    \n",
       "1                                                NaN                                    \n",
       "2           Star Wars: Episode I  The Phantom Menace                                    \n",
       "3           Star Wars: Episode I  The Phantom Menace                                    \n",
       "4           Star Wars: Episode I  The Phantom Menace                                    \n",
       "\n",
       "                                    Unnamed: 4  \\\n",
       "0  Star Wars: Episode II  Attack of the Clones   \n",
       "1                                          NaN   \n",
       "2  Star Wars: Episode II  Attack of the Clones   \n",
       "3  Star Wars: Episode II  Attack of the Clones   \n",
       "4  Star Wars: Episode II  Attack of the Clones   \n",
       "\n",
       "                                    Unnamed: 5  \\\n",
       "0  Star Wars: Episode III  Revenge of the Sith   \n",
       "1                                          NaN   \n",
       "2  Star Wars: Episode III  Revenge of the Sith   \n",
       "3  Star Wars: Episode III  Revenge of the Sith   \n",
       "4  Star Wars: Episode III  Revenge of the Sith   \n",
       "\n",
       "                          Unnamed: 6  \\\n",
       "0  Star Wars: Episode IV  A New Hope   \n",
       "1                                NaN   \n",
       "2                                NaN   \n",
       "3  Star Wars: Episode IV  A New Hope   \n",
       "4  Star Wars: Episode IV  A New Hope   \n",
       "\n",
       "                                     Unnamed: 7  \\\n",
       "0  Star Wars: Episode V The Empire Strikes Back   \n",
       "1                                           NaN   \n",
       "2                                           NaN   \n",
       "3  Star Wars: Episode V The Empire Strikes Back   \n",
       "4  Star Wars: Episode V The Empire Strikes Back   \n",
       "\n",
       "                                 Unnamed: 8  \\\n",
       "0  Star Wars: Episode VI Return of the Jedi   \n",
       "1                                       NaN   \n",
       "2                                       NaN   \n",
       "3  Star Wars: Episode VI Return of the Jedi   \n",
       "4  Star Wars: Episode VI Return of the Jedi   \n",
       "\n",
       "   Please rank the Star Wars films in order of preference with 1 being your favorite film in the franchise and 6 being your least favorite film.  \\\n",
       "0                                                3.0                                                                                               \n",
       "1                                                NaN                                                                                               \n",
       "2                                                1.0                                                                                               \n",
       "3                                                5.0                                                                                               \n",
       "4                                                5.0                                                                                               \n",
       "\n",
       "   ...         Unnamed: 28       Which character shot first?  \\\n",
       "0  ...      Very favorably  I don't understand this question   \n",
       "1  ...                 NaN                               NaN   \n",
       "2  ...    Unfamiliar (N/A)  I don't understand this question   \n",
       "3  ...      Very favorably  I don't understand this question   \n",
       "4  ...  Somewhat favorably                            Greedo   \n",
       "\n",
       "   Are you familiar with the Expanded Universe?  \\\n",
       "0                                           Yes   \n",
       "1                                           NaN   \n",
       "2                                            No   \n",
       "3                                            No   \n",
       "4                                           Yes   \n",
       "\n",
       "   Do you consider yourself to be a fan of the Expanded Universe?  \\\n",
       "0                                                 No                \n",
       "1                                                NaN                \n",
       "2                                                NaN                \n",
       "3                                                NaN                \n",
       "4                                                 No                \n",
       "\n",
       "   Do you consider yourself to be a fan of the Star Trek franchise? Gender  \\\n",
       "0                                                 No                  Male   \n",
       "1                                                Yes                  Male   \n",
       "2                                                 No                  Male   \n",
       "3                                                Yes                  Male   \n",
       "4                                                 No                  Male   \n",
       "\n",
       "     Age     Household Income                         Education  \\\n",
       "0  18-29                  NaN                High school degree   \n",
       "1  18-29         $0 - $24,999                   Bachelor degree   \n",
       "2  18-29         $0 - $24,999                High school degree   \n",
       "3  18-29  $100,000 - $149,999  Some college or Associate degree   \n",
       "4  18-29  $100,000 - $149,999  Some college or Associate degree   \n",
       "\n",
       "  Location (Census Region)  \n",
       "0           South Atlantic  \n",
       "1       West South Central  \n",
       "2       West North Central  \n",
       "3       West North Central  \n",
       "4       West North Central  \n",
       "\n",
       "[5 rows x 38 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "yes_no = {\"Yes\": True, \"No\": False}\n",
    "\n",
    "for col in [\n",
    "    \"Have you seen any of the 6 films in the Star Wars franchise?\",\n",
    "    \"Do you consider yourself to be a fan of the Star Wars film franchise?\"\n",
    "    ]:\n",
    "    star_wars[col] = star_wars[col].map(yes_no)\n",
    "\n",
    "star_wars.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "\n",
    "movie_mapping = {\n",
    "    \"Star Wars: Episode I  The Phantom Menace\": True,\n",
    "    np.nan: False,\n",
    "    \"Star Wars: Episode II  Attack of the Clones\": True,\n",
    "    \"Star Wars: Episode III  Revenge of the Sith\": True,\n",
    "    \"Star Wars: Episode IV  A New Hope\": True,\n",
    "    \"Star Wars: Episode V The Empire Strikes Back\": True,\n",
    "    \"Star Wars: Episode VI Return of the Jedi\": True\n",
    "}\n",
    "\n",
    "for col in star_wars.columns[3:9]:\n",
    "    star_wars[col] = star_wars[col].map(movie_mapping)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>RespondentID</th>\n",
       "      <th>Have you seen any of the 6 films in the Star Wars franchise?</th>\n",
       "      <th>Do you consider yourself to be a fan of the Star Wars film franchise?</th>\n",
       "      <th>seen_1</th>\n",
       "      <th>seen_2</th>\n",
       "      <th>seen_3</th>\n",
       "      <th>seen_4</th>\n",
       "      <th>seen_5</th>\n",
       "      <th>seen_6</th>\n",
       "      <th>Please rank the Star Wars films in order of preference with 1 being your favorite film in the franchise and 6 being your least favorite film.</th>\n",
       "      <th>...</th>\n",
       "      <th>Unnamed: 28</th>\n",
       "      <th>Which character shot first?</th>\n",
       "      <th>Are you familiar with the Expanded Universe?</th>\n",
       "      <th>Do you consider yourself to be a fan of the Expanded Universe?</th>\n",
       "      <th>Do you consider yourself to be a fan of the Star Trek franchise?</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Age</th>\n",
       "      <th>Household Income</th>\n",
       "      <th>Education</th>\n",
       "      <th>Location (Census Region)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>3292879998</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>3.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Very favorably</td>\n",
       "      <td>I don't understand this question</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>NaN</td>\n",
       "      <td>High school degree</td>\n",
       "      <td>South Atlantic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>3292879538</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$0 - $24,999</td>\n",
       "      <td>Bachelor degree</td>\n",
       "      <td>West South Central</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3292765271</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Unfamiliar (N/A)</td>\n",
       "      <td>I don't understand this question</td>\n",
       "      <td>No</td>\n",
       "      <td>NaN</td>\n",
       "      <td>No</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$0 - $24,999</td>\n",
       "      <td>High school degree</td>\n",
       "      <td>West North Central</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3292763116</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Very favorably</td>\n",
       "      <td>I don't understand this question</td>\n",
       "      <td>No</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$100,000 - $149,999</td>\n",
       "      <td>Some college or Associate degree</td>\n",
       "      <td>West North Central</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>3292731220</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Somewhat favorably</td>\n",
       "      <td>Greedo</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$100,000 - $149,999</td>\n",
       "      <td>Some college or Associate degree</td>\n",
       "      <td>West North Central</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 38 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   RespondentID  Have you seen any of the 6 films in the Star Wars franchise?  \\\n",
       "0    3292879998                                               True              \n",
       "1    3292879538                                              False              \n",
       "2    3292765271                                               True              \n",
       "3    3292763116                                               True              \n",
       "4    3292731220                                               True              \n",
       "\n",
       "  Do you consider yourself to be a fan of the Star Wars film franchise?  \\\n",
       "0                                               True                      \n",
       "1                                                NaN                      \n",
       "2                                              False                      \n",
       "3                                               True                      \n",
       "4                                               True                      \n",
       "\n",
       "   seen_1  seen_2  seen_3  seen_4  seen_5  seen_6  \\\n",
       "0    True    True    True    True    True    True   \n",
       "1   False   False   False   False   False   False   \n",
       "2    True    True    True   False   False   False   \n",
       "3    True    True    True    True    True    True   \n",
       "4    True    True    True    True    True    True   \n",
       "\n",
       "   Please rank the Star Wars films in order of preference with 1 being your favorite film in the franchise and 6 being your least favorite film.  \\\n",
       "0                                                3.0                                                                                               \n",
       "1                                                NaN                                                                                               \n",
       "2                                                1.0                                                                                               \n",
       "3                                                5.0                                                                                               \n",
       "4                                                5.0                                                                                               \n",
       "\n",
       "   ...         Unnamed: 28       Which character shot first?  \\\n",
       "0  ...      Very favorably  I don't understand this question   \n",
       "1  ...                 NaN                               NaN   \n",
       "2  ...    Unfamiliar (N/A)  I don't understand this question   \n",
       "3  ...      Very favorably  I don't understand this question   \n",
       "4  ...  Somewhat favorably                            Greedo   \n",
       "\n",
       "   Are you familiar with the Expanded Universe?  \\\n",
       "0                                           Yes   \n",
       "1                                           NaN   \n",
       "2                                            No   \n",
       "3                                            No   \n",
       "4                                           Yes   \n",
       "\n",
       "   Do you consider yourself to be a fan of the Expanded Universe?  \\\n",
       "0                                                 No                \n",
       "1                                                NaN                \n",
       "2                                                NaN                \n",
       "3                                                NaN                \n",
       "4                                                 No                \n",
       "\n",
       "   Do you consider yourself to be a fan of the Star Trek franchise? Gender  \\\n",
       "0                                                 No                  Male   \n",
       "1                                                Yes                  Male   \n",
       "2                                                 No                  Male   \n",
       "3                                                Yes                  Male   \n",
       "4                                                 No                  Male   \n",
       "\n",
       "     Age     Household Income                         Education  \\\n",
       "0  18-29                  NaN                High school degree   \n",
       "1  18-29         $0 - $24,999                   Bachelor degree   \n",
       "2  18-29         $0 - $24,999                High school degree   \n",
       "3  18-29  $100,000 - $149,999  Some college or Associate degree   \n",
       "4  18-29  $100,000 - $149,999  Some college or Associate degree   \n",
       "\n",
       "  Location (Census Region)  \n",
       "0           South Atlantic  \n",
       "1       West South Central  \n",
       "2       West North Central  \n",
       "3       West North Central  \n",
       "4       West North Central  \n",
       "\n",
       "[5 rows x 38 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "star_wars = star_wars.rename(columns={\n",
    "        \"Which of the following Star Wars films have you seen? Please select all that apply.\": \"seen_1\",\n",
    "        \"Unnamed: 4\": \"seen_2\",\n",
    "        \"Unnamed: 5\": \"seen_3\",\n",
    "        \"Unnamed: 6\": \"seen_4\",\n",
    "        \"Unnamed: 7\": \"seen_5\",\n",
    "        \"Unnamed: 8\": \"seen_6\"\n",
    "        })\n",
    "\n",
    "star_wars.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>RespondentID</th>\n",
       "      <th>Have you seen any of the 6 films in the Star Wars franchise?</th>\n",
       "      <th>Do you consider yourself to be a fan of the Star Wars film franchise?</th>\n",
       "      <th>seen_1</th>\n",
       "      <th>seen_2</th>\n",
       "      <th>seen_3</th>\n",
       "      <th>seen_4</th>\n",
       "      <th>seen_5</th>\n",
       "      <th>seen_6</th>\n",
       "      <th>ranking_1</th>\n",
       "      <th>...</th>\n",
       "      <th>Unnamed: 28</th>\n",
       "      <th>Which character shot first?</th>\n",
       "      <th>Are you familiar with the Expanded Universe?</th>\n",
       "      <th>Do you consider yourself to be a fan of the Expanded Universe?</th>\n",
       "      <th>Do you consider yourself to be a fan of the Star Trek franchise?</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Age</th>\n",
       "      <th>Household Income</th>\n",
       "      <th>Education</th>\n",
       "      <th>Location (Census Region)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>3292879998</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>3.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Very favorably</td>\n",
       "      <td>I don't understand this question</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>NaN</td>\n",
       "      <td>High school degree</td>\n",
       "      <td>South Atlantic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>3292879538</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$0 - $24,999</td>\n",
       "      <td>Bachelor degree</td>\n",
       "      <td>West South Central</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3292765271</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Unfamiliar (N/A)</td>\n",
       "      <td>I don't understand this question</td>\n",
       "      <td>No</td>\n",
       "      <td>NaN</td>\n",
       "      <td>No</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$0 - $24,999</td>\n",
       "      <td>High school degree</td>\n",
       "      <td>West North Central</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3292763116</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Very favorably</td>\n",
       "      <td>I don't understand this question</td>\n",
       "      <td>No</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$100,000 - $149,999</td>\n",
       "      <td>Some college or Associate degree</td>\n",
       "      <td>West North Central</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>3292731220</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5.0</td>\n",
       "      <td>...</td>\n",
       "      <td>Somewhat favorably</td>\n",
       "      <td>Greedo</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>Male</td>\n",
       "      <td>18-29</td>\n",
       "      <td>$100,000 - $149,999</td>\n",
       "      <td>Some college or Associate degree</td>\n",
       "      <td>West North Central</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 38 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   RespondentID  Have you seen any of the 6 films in the Star Wars franchise?  \\\n",
       "0    3292879998                                               True              \n",
       "1    3292879538                                              False              \n",
       "2    3292765271                                               True              \n",
       "3    3292763116                                               True              \n",
       "4    3292731220                                               True              \n",
       "\n",
       "  Do you consider yourself to be a fan of the Star Wars film franchise?  \\\n",
       "0                                               True                      \n",
       "1                                                NaN                      \n",
       "2                                              False                      \n",
       "3                                               True                      \n",
       "4                                               True                      \n",
       "\n",
       "   seen_1  seen_2  seen_3  seen_4  seen_5  seen_6  ranking_1  ...  \\\n",
       "0    True    True    True    True    True    True        3.0  ...   \n",
       "1   False   False   False   False   False   False        NaN  ...   \n",
       "2    True    True    True   False   False   False        1.0  ...   \n",
       "3    True    True    True    True    True    True        5.0  ...   \n",
       "4    True    True    True    True    True    True        5.0  ...   \n",
       "\n",
       "          Unnamed: 28       Which character shot first?  \\\n",
       "0      Very favorably  I don't understand this question   \n",
       "1                 NaN                               NaN   \n",
       "2    Unfamiliar (N/A)  I don't understand this question   \n",
       "3      Very favorably  I don't understand this question   \n",
       "4  Somewhat favorably                            Greedo   \n",
       "\n",
       "   Are you familiar with the Expanded Universe?  \\\n",
       "0                                           Yes   \n",
       "1                                           NaN   \n",
       "2                                            No   \n",
       "3                                            No   \n",
       "4                                           Yes   \n",
       "\n",
       "   Do you consider yourself to be a fan of the Expanded Universe?  \\\n",
       "0                                                 No                \n",
       "1                                                NaN                \n",
       "2                                                NaN                \n",
       "3                                                NaN                \n",
       "4                                                 No                \n",
       "\n",
       "   Do you consider yourself to be a fan of the Star Trek franchise? Gender  \\\n",
       "0                                                 No                  Male   \n",
       "1                                                Yes                  Male   \n",
       "2                                                 No                  Male   \n",
       "3                                                Yes                  Male   \n",
       "4                                                 No                  Male   \n",
       "\n",
       "     Age     Household Income                         Education  \\\n",
       "0  18-29                  NaN                High school degree   \n",
       "1  18-29         $0 - $24,999                   Bachelor degree   \n",
       "2  18-29         $0 - $24,999                High school degree   \n",
       "3  18-29  $100,000 - $149,999  Some college or Associate degree   \n",
       "4  18-29  $100,000 - $149,999  Some college or Associate degree   \n",
       "\n",
       "  Location (Census Region)  \n",
       "0           South Atlantic  \n",
       "1       West South Central  \n",
       "2       West North Central  \n",
       "3       West North Central  \n",
       "4       West North Central  \n",
       "\n",
       "[5 rows x 38 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "star_wars = star_wars.rename(columns={\n",
    "        \"Please rank the Star Wars films in order of preference with 1 being your favorite film in the franchise and 6 being your least favorite film.\": \"ranking_1\",\n",
    "        \"Unnamed: 10\": \"ranking_2\",\n",
    "        \"Unnamed: 11\": \"ranking_3\",\n",
    "        \"Unnamed: 12\": \"ranking_4\",\n",
    "        \"Unnamed: 13\": \"ranking_5\",\n",
    "        \"Unnamed: 14\": \"ranking_6\"\n",
    "        })\n",
    "\n",
    "star_wars.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "star_wars[star_wars.columns[9:15]] = star_wars[star_wars.columns[9:15]].astype(float)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "ranking_1    3.732934\n",
       "ranking_2    4.087321\n",
       "ranking_3    4.341317\n",
       "ranking_4    3.272727\n",
       "ranking_5    2.513158\n",
       "ranking_6    3.047847\n",
       "dtype: float64"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "star_wars[star_wars.columns[9:15]].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<BarContainer object of 6 artists>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWoAAAD4CAYAAADFAawfAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAJ20lEQVR4nO3dT6jld3nH8c/TybRKtLjIpYRM6O2iBMSFkUu6CHQRbElNsF10YcCsLLOpEGlB4qp050rcuBk0tEUxSGOhJPRPwIQQ0OidGK1xtEhJaVCYKyI6m5bo4+KeqUm8yT3jPWfOc8+8XnDJOXN+c3h+DHnz5Xd/33OquwPAXL+x6QEAeHNCDTCcUAMMJ9QAwwk1wHA3reNNb7nllt7d3V3HWwNspYsXL/6wu3eOem0tod7d3c3+/v463hpgK1XVf7/Ray59AAwn1ADDCTXAcEINMJxQAwwn1ADDCTXAcEIN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NJHunuF9c+2WqNvCRzAtt2Psn2ndO2nU+yfed0as7n2F8mArBZdiYCDCfUAMNtdai3bet7VT1SVZer6lubnmUVqur2qnqqqi5V1YtV9dCmZzqpqnpLVX21qr6xOKe/3fRMq1BVZ6rq61X1+KZnWYWqeqmq/qOqXqiq/U3Pc5ytvUa92Pr+n0n+KIe3GH4tyQPd/e2NDnYCVfWHSa4k+Yfuftem5zmpqro1ya3d/XxVvT3JxSR/dsr/jSrJzd19parOJnk2yUPd/ZUNj3YiVfVXSfaS/HZ337/peU6qql5Kstfdkza8vKFtXlFv3db37n4myY82PceqdPcPuvv5xeOfJrmU5LbNTnUyfejK4unZxc+pXg1V1bkk9yX59KZnuVFtc6hvS/I/r3r+ck55BLZZVe0muTPJc5ud5OQWlwleSHI5yZPdfdrP6ZNJPprk55seZIU6yb9X1cXFx1+Mts2hXmrrO5tXVW9L8liSj3T3TzY9z0l198+6+9053MV7V1Wd2stUVXV/ksvdfXHTs6zY3d39nhx+KuhfLi4rjrXNobb1/RRYXMd9LMnnuvuLm55nlbr7x0meTnLvhkc5ibuTvH9xTffRJPdU1Wc3O9LJdff3F/+9nOSfcnipdKxtDrWt78MtfvH2mSSXuvsTm55nFapqp6resXj81iTvTfKdzU716+vuj3X3ue7ezeH/Q1/q7g9ueKwTqaqbF7+8TlXdnOSPk4y+k2prQ93dryS5uvX9UpIvnMKt769RVZ9P8uUkd1TVy1X1oU3PdEJ3J3kwh6u0FxY/79v0UCd0a5KnquqbOVwsPNndW3FL2xb5nSTPVtU3knw1yRPd/a8bnulNbe3teQDbYmtX1ADbQqgBhhNqgOGEGmA4oQYYTqgBhhNqgOF+AeNYG5raNfHFAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "plt.bar(range(6), star_wars[star_wars.columns[9:15]].mean())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Rankings\n",
    "\n",
    "So far, we've cleaned up the data, renamed several columns, and computed the average ranking of each movie. As we suspected, it looks like the \"original\" movies are rated much more highly than the newer ones."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "seen_1    673\n",
       "seen_2    571\n",
       "seen_3    550\n",
       "seen_4    607\n",
       "seen_5    758\n",
       "seen_6    738\n",
       "dtype: int64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "star_wars[star_wars.columns[3:9]].sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<BarContainer object of 6 artists>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 5796 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.bar(range(6), star_wars[star_wars.columns[3:9]].sum())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# View counts\n",
    "\n",
    "It appears that more respondents aw the original movies than the newer movies. This reinforces what we saw in the rankings, where the earlier movies seem to be more popular."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "males = star_wars[star_wars[\"Gender\"] == \"Male\"]\n",
    "females = star_wars[star_wars[\"Gender\"] == \"Female\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 5508 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_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7f5zk6ST3bniUkzif5P2Lc7qfT3JPVX1msyOdXHd/f/HfK0n+MYenSsfa5lC79X24xQdvn05yubs/sel5VqGqdqrqXYvHb0vyviTf2exUv7ru/lh3n+vu3Rz+P/Sl7v7ghsc6kaq6ZfHhdarqliR/mGT0lVRbG+rufjXJ1VvfLyf5wim89f11qupzSb6c5M6qermqPrTpmU7ofJKHcrhLe2Hxc9+mhzqh25I8VVXfzOFm4cnu3opL2rbIbyZ5tqq+keSrSZ7o7n/Z8ExvaWsvzwPYFlu7owbYFkINMJxQAwwn1ADDCTXAcEINMJxQAwz3f7ojHYkoKOLhAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.bar(range(6), males[males.columns[9:15]].mean())\n",
    "plt.show()\n",
    "\n",
    "plt.bar(range(6), females[females.columns[9:15]].mean())\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 6048 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 5712 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.bar(range(6), males[males.columns[3:9]].sum())\n",
    "plt.show()\n",
    "\n",
    "plt.bar(range(6), females[females.columns[3:9]].sum())\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Male/female differences in favorite Star Wars movie and most-seen movie\n",
    "\n",
    "Interestingly, more males watches episodes 1-3, but males liked them far less than females did."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
