LoslegenKostenlos loslegen

Data filtration

As you noticed in the video lesson, you may need to filter your data for various reasons.

In this exercise, you will use filtering to select a specific part of our DataFrame:

  • by the number of entries recorded in each day of the week
  • by the mean amount of money the customers paid to the restaurant each day of the week

Diese Übung ist Teil des Kurses

Writing Efficient Code with pandas

Kurs anzeigen

Interaktive Übung

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

# Filter the days where the count of total_bill is greater than $40
total_bill_40 = restaurant_data.groupby('day').____(lambda x: ____[____].____() > 40)

# Print the number of tables where total_bill is greater than $40
print('Number of tables where total_bill is greater than $40:', total_bill_40.shape[0])
Code bearbeiten und ausführen