BaşlayınÜcretsiz Başlayın

Filtering

You'll recall from our previous exercises that the most ticket sales were all occurring in Los Angeles, making it difficult to look at other theater locations' performances. If we wanted to look at a subset of our data, such as one theater location, we'll have to filter our data.

Bu egzersiz

Python for Spreadsheet Users

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Filter the theater_location column of sales for only New York - don't forget quotation marks!
  • Print the head of New York sales.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Import the pandas package as pd
import pandas as pd

# Read in the Excel file
sales = pd.read_excel('ticket_sales.xlsx')

# Filter for New York sales only
new_york_sales = sales[sales[____] == ____].reset_index(drop=True)

# Print the first 5 rows of new_york_sales
____(new_york_sales.____())
Kodu Düzenle ve Çalıştır