<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jamie Isabel on Medium]]></title>
        <description><![CDATA[Stories by Jamie Isabel on Medium]]></description>
        <link>https://medium.com/@jamieisabel?source=rss-fb93dd3d92e5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*qv3n_O_zW1Cxl_QZ.</url>
            <title>Stories by Jamie Isabel on Medium</title>
            <link>https://medium.com/@jamieisabel?source=rss-fb93dd3d92e5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 12:05:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jamieisabel/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Dotz Pretzels Analysis]]></title>
            <link>https://medium.com/paint-the-world-with-data/dotz-pretzels-analysis-33e85024766b?source=rss-fb93dd3d92e5------2</link>
            <guid isPermaLink="false">https://medium.com/p/33e85024766b</guid>
            <category><![CDATA[analytics]]></category>
            <dc:creator><![CDATA[Jamie Isabel]]></dc:creator>
            <pubDate>Sun, 02 Sep 2018 15:36:19 GMT</pubDate>
            <atom:updated>2018-09-02T15:36:19.712Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Exploratory Data Analysis in Python</blockquote><p>Dotz Pretzels began selling their pretzels online and now they’re running into issues when they have to spend additional time packaging multiple product orders. They’re looking for an answer to “What are the optimal packages to package then sell online.”</p><p>We have data on their past purchases so I start there.</p><h4><strong>Importing necessary libraries and opening the file</strong></h4><pre>import matplotlib.pyplot as plt<br>import pandas as pd<br>import os<br>import sys<br>import numpy as np<br>__file__ = r&quot;/Users/jamie/Downloads/Dots Pretzels.xls&quot;</pre><pre>abc = os.path.dirname(os.path.abspath(__file__))</pre><pre>data = pd.read_excel(__file__, sheet_name=&#39;Purchase History - Online Order&#39;)</pre><pre>data.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wDtw4O5oanoZFFPTRXfk-g.png" /></figure><p><strong>Let’s start by taking a look at the number of total products ordered by variant</strong></p><pre>data[[&#39;1X5OZ_A&#39;,&#39;5OZ_B&#39;,&#39;1LB_C&#39;,&#39;2LB_D&#39;,&#39;RUB_E&#39;]].sum().sort_values(ascending=<strong>False</strong>).plot(kind=&#39;bar&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*NMZtWkoZYbOjczwxNBRGeA.png" /></figure><p>Most of the products sold are the 2 LB D product. Let’s take a look at the top selling combinations to see if that holds up the same.</p><pre>data[&#39;COMBO&#39;].loc[data[&#39;SKU&#39;] &gt; 1].value_counts().sort_values(ascending=False).plot(kind=&#39;bar&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*RXh1q0NMQ6V1G8nSiZPpGA.png" /></figure><h3>Understanding the top product combos</h3><p>The average number of products for the top combos could be helpful for determining the best package deal to offer to the customers.</p><h4>DE Combo</h4><pre>de_package = data[[&#39;2LB_D&#39;, &#39;RUB_E&#39;]].loc[data.COMBO == &#39;DE&#39;]<br>de_package.describe()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*8gYNEcowXWTJV7IKnKOg3A.png" /></figure><h4>I realized that the means of each of the columns could be easily thrown off by outliers</h4><p>Instead of looking at the means, I’ll take a look at the count of each of the combinations.</p><pre>ab = de_package.groupby([&#39;2LB_D&#39;,&#39;RUB_E&#39;]).size().reset_index().rename(columns={0:&#39;count&#39;}).sort_values(ascending=<strong>False</strong>, by=&#39;count&#39;)<br><br>ab.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*mjWFnFVv1Qi00de1D8aIQQ.png" /></figure><h4>Curious about how much outliers may affect the data?</h4><p>Although 3 and 1 are the mediums of the columns, I’d rather go with the package that’s already purchased the most. the 2 1 combo has double the purchases than 3 1 combo.</p><pre>de_package.median()</pre><pre>2LB_D    3.0<br>RUB_E    1.0<br>dtype: float64</pre><p>I repeat the process for the next 2 most popular combinations.</p><h4>DC Combination</h4><pre>dc_package = data[[&#39;2LB_D&#39;, &#39;1LB_C&#39;]].loc[data.COMBO == &#39;CD&#39;]<br>dc_package.describe()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*M1pn9QEFVKl_9JkuwA62cg.png" /></figure><pre>ab = dc_package.groupby([&#39;2LB_D&#39;,&#39;1LB_C&#39;]).size().reset_index().rename(columns={0:&#39;count&#39;}).sort_values(ascending=<strong>False</strong>, by=&#39;count&#39;)<br><br>ab.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*cs4F6qcS-zsXOxU-b7L_9A.png" /></figure><pre>dc_package.median()</pre><pre>2LB_D    2.0<br>1LB_C    2.0<br>dtype: float64</pre><h4>CE Combo</h4><pre>ce_package = data[[&#39;RUB_E&#39;, &#39;1LB_C&#39;]].loc[data.COMBO == &#39;CE&#39;]<br>ce_package.describe()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*OgoxpYvPFGhERZ-2qz7MJQ.png" /></figure><pre>ab = ce_package.groupby([&#39;1LB_C&#39;,&#39;RUB_E&#39;]).size().reset_index().rename(columns={0:&#39;count&#39;}).sort_values(ascending=<strong>False</strong>, by=&#39;count&#39;)<br><br>ab.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*sSmVtBX4jSjK3-xpCvSXTQ.png" /></figure><pre>ce_package.median()</pre><pre>RUB_E    1.0<br>1LB_C    4.0<br>dtype: float64</pre><h4>Are orders with different items even the most popular orders?</h4><p>Orders with different products may not be the most popular orders. There is a good chance that orders with just 1 SKU and multiple units are a majority of sales.</p><pre>abe = data.SKU.value_counts()<br>abe</pre><pre>1    11974<br>2     2728<br>3      377<br>0      114<br>4       37<br>Name: SKU, dtype: int64</pre><p>There are 11,974 single SKU orders versus 2,728 multiple SKU orders. What’s the percentage of the total that single SKU orders take up?</p><pre><em>#math</em> <br>test = abe[1] / abe[0:5].sum() <br>test</pre><pre>0.7862114248194353</pre><p><strong>78.62%</strong></p><pre>sku_single = data.units.loc[data.SKU == 1]<br><br>sku_single.value_counts().sort_values(ascending=<strong>False</strong>)[:10].plot(kind=&#39;bar&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*TOSE_NIzu6MI8lTvA7BLZA.png" /></figure><h4>Wow, there are more 2 unit orders than there are 1 unit orders.</h4><p>2 unit, 1 SKU orders are the most popular by a wide margin over orders with 2 or more SKUs.</p><pre>numbers = data.loc[data.SKU == 1][&#39;units&#39;].value_counts()<br>numbers.head(10)</pre><pre>2     3227<br>3     2007<br>4     1570<br>6     1335<br>1     1334<br>5      861<br>10     537<br>8      222<br>7      193<br>12     173<br>Name: units, dtype: int64</pre><h4>Taking a step back and putting this in perspective.</h4><pre>data.groupby(&#39;COMBO&#39;)[&#39;units&#39;].size().sort_values(ascending=<strong>False</strong>)</pre><pre>COMBO<br>D        8242<br>C        3236<br>DE       1036<br>CD        830<br>CE        379<br>CDE       196<br>BC        190<br>B         177<br>BD        161<br>E         152<br>A         114<br>BCD        87<br>AD         71<br>AC         64<br>ABC        36<br>BCE        35<br>ACD        33<br>BDE        27<br>AB         25<br>BCDE       25<br>ACE        20<br>BE         18<br>ABCD       16<br>ADE        15<br>ABCDE      12<br>ABCE        8<br>AE          7<br>ACDE        6<br>ABE         5<br>ABD         5<br>ABDE        2<br>Name: units, dtype: int64</pre><h4>We’ve found combo numbers 1 and 2</h4><p>2 2lb_d and 3 2lb_d. These combinations are more popular than the top 2 SKU order.</p><pre>data.loc[data.COMBO == &#39;D&#39;][&#39;units&#39;].value_counts().head()</pre><pre>2    2605<br>3    1459<br>1    1095<br>6     946<br>4     930<br>Name: units, dtype: int64</pre><h4>Wow, people buy 4 1LB bags most frequently in terms of combos.</h4><p>We’ll keep 2 options here for variety in options. This leaves us with the 4 and 2 quantity options.</p><pre>data.loc[data.COMBO == &#39;C&#39;][&#39;units&#39;].value_counts().head()</pre><pre>4    598<br>2    570<br>3    505<br>5    345<br>6    340<br>Name: units, dtype: int64</pre><h4>Finally, we will look at our most popular 2 SKU order.</h4><p>We will only keep the top option here.</p><pre>data.loc[data.COMBO == &#39;DE&#39;][&#39;units&#39;].value_counts().head()</pre><pre>3    243<br>4    179<br>6    163<br>2    131<br>5     93<br>Name: units, dtype: int64</pre><h4>Top Combos By Transactions</h4><blockquote>PACKAGES FOR DOTZ PRETZELS</blockquote><p>2 2LB_D</p><p>3 2LB_D</p><p>4 1LB_C</p><p>2 1LB_C</p><p>2 2LB_D + 1 RUB_E</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33e85024766b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/paint-the-world-with-data/dotz-pretzels-analysis-33e85024766b">Dotz Pretzels Analysis</a> was originally published in <a href="https://medium.com/paint-the-world-with-data">Data Projects</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>