<jupyter_start><jupyter_text>Challenge 3In this challenge we will work on the `Orders.csv` data set in the previous [Subsetting and Descriptive Stats lab](../../lab-subsetting-and-descriptive-stats/your-code/main.ipynb). In your work you will apply the thinking process and workflow we showed you in Challenge 2.You are serving as a Business Intelligence Analyst at the headquarter of an international fashion goods chain store. Your boss today asked you to do two things for her:**First, identify two groups of customers from the data set.** The first group is **VIP Customers** whose **aggregated expenses** at your global chain stores are **above the 95th percentile** (aka. 0.95 quantile). The second group is **Preferred Customers** whose **aggregated expenses** are **between the 75th and 95th percentile**.**Second, identify which country has the most of your VIP customers, and which country has the most of your VIP+Preferred Customers combined.**  Q1: How to identify VIP & Preferred Customers?We start by importing all the required libraries:<jupyter_code># import required libraries
import numpy as np
import pandas as pd<jupyter_output><empty_output><jupyter_text>Next, import `Orders.csv` from the "subsetting" lab folder into a dataframe variable called `orders`. Print the head of `orders` to overview the data:<jupyter_code># enter your code here
orders = pd.read_csv("../../lab-subsetting-and-descriptive-stats/your-code/Orders.csv")
orders.head()<jupyter_output><empty_output><jupyter_text>---"Identify VIP and Preferred Customers" is the non-technical goal of your boss. You need to translate that goal into technical languages that data analysts use: How to label customers whose aggregated `amount_spent` is in a given quantile range? Using the iterative data analysis workflow, we break down the main problem into several sub problems: Main Problem - Setting Expectations**Sub Problem 1: How to aggregate the  `amount_spent` for unique customers?****Sub Problem 2: How to select customers whose aggregated `amount_spent` is in a given quantile range?****Sub Problem 3: How to label selected customers as "VIP" or "Preferred"?***Note: If you want to break down the main problem in a different way, please feel free to revise the sub problems above.*--- Now in the workspace below, tackle each of the sub problems using the iterative problem solving workflow. Insert cells as necessary to write your codes and explain your steps. Main Problem - Collecting Information Sub Problem 1 - Setting Expectations **How to aggregate the  `amount_spent` for unique customers?**  Sub Probme 1 - Collecting Information<jupyter_code># enter your code<jupyter_output><empty_output><jupyter_text>Sub Probme 1 - Reacting to Data / Revising Expectations ---1. *Test your output.*1. *Revise solution or declare success for the sub problem.*---  Sub Problem 2 - Setting Expectations **How to select customers whose aggregated `amount_spent` is in a given quantile range?**  Sub Problem 2 - Collecting information<jupyter_code># enter your code<jupyter_output><empty_output><jupyter_text>Sub Problem 2 - Reacting to Data / Revising Expectations ---1. *Test your output.*1. *Revise solution or declare success for the sub problem.*---  Sub Problem 3 - Setting Expectations How to label selected customers as "VIP" or "Preferred"?  Sub Problem 3 - Collecting Information<jupyter_code># enter your code<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07696793002915452, 'fraction_numerical': 0.007871720116618075, 'mean_word_length': 5.226860254083484, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '221531', 'license': 'Unlicense', 'n_tokens_mistral': 920, 'n_tokens_neox': 861, 'n_words': 444, 'path': 'module-2/lab-df-calculation-and-transformation/your-code/challenge-3.ipynb', 'repo_name': 'ijcernicharo/datamad18_ijcernicharo', 'size': '3430'}