본문 바로가기

Algorithm/Python

[stratascratch] Churro Activity Date(Python)

문제

Find the activity date and the pe_description of facilities with the name 'STREET CHURROS' and with a score of less than 95 points.

name이 'STREET CHURROS'와 score가 95미만인 activity date 와 pd_description 조회하기

코드

# Import your libraries
import pandas as pd

# Start writing code
result = los_angeles_restaurant_health_inspections[(los_angeles_restaurant_health_inspections['facility_name'] == 'STREET CHURROS') &
    (los_angeles_restaurant_health_inspections['score'] < 95)
][['activity_date', 'pe_description']]
result['activity_date'] = result['activity_date'].dt.date
result

출처

반응형