Session Ready
Exercise

Building hosts DataFrame

Your task here is to prepare a DataFrame hosts by left joining editions and ioc_codes.

Once created, you will subset the Edition and NOC columns and set Edition as the Index.

There are some missing NOC values; you will set those explicitly.

Finally, you'll reset the Index & print the final DataFrame.

Instructions
100 XP
  • Create the DataFrame hosts by doing a left join on DataFrames editions and ioc_codes (using pd.merge()).
  • Clean up hosts by subsetting and setting the Index.
    • Extract the columns 'Edition' and 'NOC'.
    • Set 'Edition' column as the Index.
  • Use the .loc[] accessor to find and assign the missing values to the 'NOC' column in hosts. This has been done for you.
  • Reset the index of hosts using .reset_index(), which you'll need to save as the hosts DataFrame.
  • Hit 'Submit Answer' to see what hosts looks like!