<jupyter_start><jupyter_text>______ Ecommerce Purchases ExerciseThis is some Fake Data about some purchases done through Amazon!<jupyter_code>import pandas as pd
df = pd.read_csv("Ecommerce Purchases")<jupyter_output><empty_output><jupyter_text>**Check the head of the DataFrame.**<jupyter_code>df.head()<jupyter_output><empty_output><jupyter_text>**How many rows and columns are there?**<jupyter_code>df.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 10000 entries, 0 to 9999
Data columns (total 14 columns):
Address             10000 non-null object
Lot                 10000 non-null object
AM or PM            10000 non-null object
Browser Info        10000 non-null object
Company             10000 non-null object
Credit Card         10000 non-null int64
CC Exp Date         10000 non-null object
CC Security Code    10000 non-null int64
CC Provider         10000 non-null object
Email               10000 non-null object
Job                 10000 non-null object
IP Address          10000 non-null object
Language            10000 non-null object
Purchase Price      10000 non-null float64
dtypes: float64(1), int64(2), object(11)
memory usage: 1.1+ MB<jupyter_text>**What is the average Purchase Price?**<jupyter_code>df["Purchase Price"].mean()<jupyter_output><empty_output><jupyter_text>**What were the highest and lowest purchase prices?**<jupyter_code>df["Purchase Price"].max()
df["Purchase Price"].min()<jupyter_output><empty_output><jupyter_text>**How many people have English 'en' as their Language of choice on the website?**<jupyter_code>languages = df["Language"]
english = df[languages == "en"]
english["Email"].unique().size<jupyter_output><empty_output><jupyter_text>**How many people have the job title of "Lawyer" ?**<jupyter_code>def is_Lawyer(value):
    if "Lawyer" in value.split(" "):
        return 1
    return 0

df["Job"].apply(is_Lawyer).sum()<jupyter_output><empty_output><jupyter_text>**How many people made the purchase during the AM and how many people made the purchase during PM ?****(Hint: Check out [value_counts()](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.value_counts.html) )**<jupyter_code>df["AM or PM"].value_counts()<jupyter_output><empty_output><jupyter_text>**What are the 5 most common Job Titles?**<jupyter_code>df["Job"].value_counts().head()<jupyter_output><empty_output><jupyter_text>**Someone made a purchase that came from Lot: "90 WT" , what was the Purchase Price for this transaction?**<jupyter_code>df[df["Lot"]=="90 WT"]<jupyter_output><empty_output><jupyter_text>**What is the email of the person with the following Credit Card Number: 4926535242672853**<jupyter_code>df[df["Credit Card"]==4926535242672853]["Email"]<jupyter_output><empty_output><jupyter_text>**How many people have American Express as their Credit Card Provider *and* made a purchase above $95 ?**<jupyter_code>american = df["CC Provider"]=="American Express"
gt95 = df["Purchase Price"] > 95
df[american][gt95].size<jupyter_output>C:\Users\julio\AppData\Local\Continuum\anaconda3\lib\site-packages\ipykernel_launcher.py:3: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  This is separate from the ipykernel package so we can avoid doing imports until<jupyter_text>**Hard: How many people have a credit card that expires in 2025?**<jupyter_code>def expire_in_2025(value):
    if value.endswith("25"):
        return 1
    return 0
df["CC Exp Date"].apply(expire_in_2025).count()<jupyter_output><empty_output><jupyter_text>**Hard: What are the top 5 most popular email providers/hosts (e.g. gmail.com, yahoo.com, etc...)**<jupyter_code>def get_provider(email):
    return email.split("@")[1]
df["Email"].apply(get_provider).value_counts().head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12041193556905203, 'fraction_numerical': 0.04357010826511751, 'mean_word_length': 5.497427101200686, 'pattern_counts': {'":': 0, '<': 56, '<?xml version=': 0, '>': 57, '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': '14', 'dir': 'jupyter-structured-clean-dedup', 'id': '508610', 'license': 'MIT', 'n_tokens_mistral': 1369, 'n_tokens_neox': 1226, 'n_words': 322, 'path': 'Ecommerce Purchases.ipynb', 'repo_name': 'juliocnsouzadev/ecommerce-purchases-analysis-pandas', 'size': '3787'}