Youtube Video commentary is also available.
P-007: Specify the columns in the order of sales date (sales_ymd), customer ID (customer_id), product code (product_cd), sales amount (amount) from the receipt detail data frame (df_receipt), and select the data that meets the following conditions Extract. --Customer ID (customer_id) is "CS018205000001" --Sales amount (amount) is 1,000 or more and 2,000 or less
code
df_receipt[['sales_ymd', 'customer_id', 'product_cd', 'amount']] \
.query('customer_id == "CS018205000001" & 1000 <= amount <= 2000 ')
output
sales_ymd customer_id product_cd amount
72254 20180911 CS018205000001 P071401005 1100
**-In Pandas DataFrame / Series, while specifying columns, it is a method to check the rows that meet the conditions among the specified rows.
-Use this when you want to narrow down the column information, specify the row, and check the information that meets the conditions.
ยท' [['
Recommended Posts