ComenzarEmpieza gratis

Filtrado de datos

Como viste en la lección en vídeo, puede que necesites filtrar tus datos por varios motivos.

En este ejercicio, usarás filtrado para seleccionar una parte específica de nuestro DataFrame:

  • por el número de registros en cada día de la semana
  • por el importe medio que los clientes pagaron al restaurante cada día de la semana

Este ejercicio forma parte del curso

Escribir código eficiente con pandas

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# 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])
Editar y ejecutar código