LoslegenKostenlos loslegen

Merging for theater locations

Hey! We don't have theater locations now, we have theater names. But what if we want both?

Currently loaded are two DataFrames:

  • theater_sales - A summary of tickets sold in each theater, based on the theater name.
  • theater_info - A table of theater names and the location of each theater.

Feel free to check them out in the console to get a better understanding of them.

They have key columns, but the names don't match. Let's handle this join in the exercise!

Diese Übung ist Teil des Kurses

Python for Spreadsheet Users

Kurs anzeigen

Anleitung zur Übung

  • Use the .merge() method on theater_sales to join theater_info on the correct key columns.
  • Use the .drop() method to remove the redundant theater column from sales_join.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Join the tables
sales_join = ____

# Drop the redundant theater column
sales_complete = ____

# Print the table
print(sales_complete)
Code bearbeiten und ausführen