Untitled
unknown
plain_text
8 months ago
995 B
5
Indexable
data = {
"customer_id": [1, 2, 1, 3, 2, 3, 1, 2, 3, 1],
"purchase_amount": [100, 200, 150, 300, 250, 180, 220, 275, 320, 130],
"purchase_date": [
"2024-02-01", "2024-02-02", "2024-02-02", "2024-02-03", "2024-02-04",
"2024-02-05", "2024-02-06", "2024-02-07", "2024-02-08", "2024-02-09"
],
"product_category": [
"Electronics", "Clothing", "Electronics", "Home", "Clothing",
"Home", "Sports", "Clothing", "Electronics", "Sports"
],
"payment_method": [
"Credit Card", "PayPal", "Debit Card", "Credit Card", "PayPal",
"Cash", "Debit Card", "Credit Card", "Debit Card", "Cash"
],
"discount_applied": [10, 20, 15, 30, 25, 0, 5, 10, 20, 5], # In percentage
"store_location": [
"New York", "Los Angeles", "New York", "Chicago", "Los Angeles",
"Chicago", "Houston", "Los Angeles", "New York", "Houston"
]
}
# Using pandas or SQL, calculate the purchase_amount per customer Editor is loading...
Leave a Comment