문제
Find order details made by Jill and Eva. Consider the Jill and Eva as first names of customers. Output the order date, details and cost along with the first name. Order records based on the customer id in ascending order.
Jill과 Eva가 만든 주문을 찾아서 주문 날짜, 상세 내역 및 비용을 이름과 함께 출력하기
고객 ID를 기준으로 오름차순으로 정렬
코드
# Import your libraries
import pandas as pd
# Start writing code
result = pd.merge(customers, orders, how="inner", left_on="id", right_on="cust_id").sort_values('cust_id')
cond = (result["first_name"] == 'Jill') | (result["first_name"] == 'Eva')
result[cond][["first_name", "order_date", "order_details", "total_order_cost"]]
출처
반응형
'Algorithm > Python' 카테고리의 다른 글
[stratascratch] Churro Activity Date(Python) (0) | 2021.08.19 |
---|---|
[stratascratch] Customer Details(Python) (0) | 2021.08.15 |
[stratascratch] Largest Olympics(Python) (0) | 2021.08.15 |
[stratascratch] find the top 10 ranked songs in 2010(Python) (0) | 2021.08.15 |
[stratascratch] number of bathrooms and bedrooms(Python) (0) | 2021.08.15 |