<?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 Noshin Nawar Nawar on Medium]]></title>
        <description><![CDATA[Stories by Noshin Nawar Nawar on Medium]]></description>
        <link>https://medium.com/@noshinnawarneha?source=rss-c8ba38c0cb1e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*m1zoXdTMQzE88JZvZ-gzsg.png</url>
            <title>Stories by Noshin Nawar Nawar on Medium</title>
            <link>https://medium.com/@noshinnawarneha?source=rss-c8ba38c0cb1e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 03:32:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@noshinnawarneha/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[How to import csv with null values in MySQL Workbench]]></title>
            <link>https://medium.com/@noshinnawarneha/how-to-import-csv-with-null-values-in-mysql-workbench-76341447570d?source=rss-c8ba38c0cb1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/76341447570d</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[import-csv-data]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Noshin Nawar Nawar]]></dc:creator>
            <pubDate>Mon, 16 Feb 2026 15:28:31 GMT</pubDate>
            <atom:updated>2026-02-16T15:28:31.823Z</atom:updated>
            <content:encoded><![CDATA[<h4>This solution worked for me. Hope it will help you as well.</h4><p>I was struggling with import csv file with null values. MySQL Workbench was not accepting the rows after getting null values. So after many trial and errors, this solution helped me.</p><p>For this example, I am using this csv:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*yC6HnRmgFogmLz-0jR87kA.png" /><figcaption>Image of data by Author</figcaption></figure><p>Here I have manually added \N in the empty cells.</p><p>Now, let&#39;s begin the MySQL part.</p><p>Firstly, create a schema. I created a schema called “window” (I was actually practicing window functions).</p><p>Then create the table and specify which columns will accept null values.</p><pre>CREATE TABLE `window`.customers (<br>    CustomerID INT PRIMARY KEY,<br>    FirstName VARCHAR(50) NULL,<br>    LastName VARCHAR(50) NULL,<br>    Country VARCHAR(50) NULL,<br>    Score INT NULL<br>);</pre><p>These were the common steps. Now you need some special commands for importing the csv.</p><p>Run the query below in Workbench:</p><pre>SET GLOBAL local_infile = 1;</pre><p>Then check if it is enabled or not:</p><pre>SHOW GLOBAL VARIABLES LIKE &#39;local_infile&#39;;</pre><p>The output will be something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/271/1*HTJ4Q92w8Sv196l1W_Gmmg.png" /><figcaption>Image by Author</figcaption></figure><p>Now you need to enable the MySQL Workbench connection.</p><p>Go to the Database tab and in the dropdown select Manage Connections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*lnZAdyPK5ft6xXU_dDWTYA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*T5xzFLDTfoankTygxjnieQ.png" /><figcaption>Image by Author</figcaption></figure><p>Click on your MySQL connection and then click on the Advanced tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*HoYKdiAQp4n4Y60iLdIxKA.png" /><figcaption>Image by Author</figcaption></figure><p>Then in the Others field write this line:</p><pre>OPT_LOCAL_INFILE=1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tU74Ycoa9wME3X7eLbntkQ.png" /><figcaption>Image by Author</figcaption></figure><p>Click Close and restart MySQL Workbench.</p><p>Now first choose the database using USE clause.</p><pre>use `window`</pre><p>Then run this query:</p><pre>LOAD DATA LOCAL INFILE &#39;D:/wherever-you-kept-your-datafile/Customers.csv&#39;<br>INTO TABLE customers<br>FIELDS TERMINATED BY &#39;,&#39; <br>OPTIONALLY ENCLOSED BY &#39;&quot;&#39;<br>LINES TERMINATED BY &#39;\n&#39;<br>IGNORE 1 ROWS<br>(CustomerID, @FirstName, @LastName, @Country, @Score)<br>SET <br>    FirstName = NULLIF(@FirstName, &#39;&#39;),<br>    LastName = NULLIF(@LastName, &#39;&#39;),<br>    Country = NULLIF(@Country, &#39;&#39;),<br>    Score = NULLIF(@Score, &#39;&#39;);</pre><p>Check if all the rows have imported or not.</p><p>That’s it. You imported the data successfully, now you can start querying your data.</p><p>Hope it helps.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76341447570d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EDA with Polars and Plotly: Order Record Analysis]]></title>
            <link>https://levelup.gitconnected.com/eda-with-polars-and-plotly-order-record-analysis-9e8ffdf76c5a?source=rss-c8ba38c0cb1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e8ffdf76c5a</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[plotly]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[exploratory-data-analysis]]></category>
            <category><![CDATA[polars-dataframe]]></category>
            <dc:creator><![CDATA[Noshin Nawar Nawar]]></dc:creator>
            <pubDate>Sat, 31 Jan 2026 19:41:58 GMT</pubDate>
            <atom:updated>2026-02-23T16:53:56.912Z</atom:updated>
            <content:encoded><![CDATA[<h4>Let’s extract insights from the data</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UMDONM8fucVMyw_GOtH4mA.jpeg" /><figcaption>Image by Author</figcaption></figure><p>This EDA project is beginner-friendly and a good starting point for someone who wants a hands-on project with Polars, a lightning-fast open-source library for data manipulation.</p><p>Before starting the project, let’s take a look at the data.</p><h4>Dataset</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lzvHqki1ZvxC2y52qttGYw.png" /><figcaption>Image of first 6 rows of data by Author</figcaption></figure><ul><li>OrderID: Primary ID for each order</li><li>CustomerName: The name of the customer</li><li>Product: The item that was ordered</li><li>Category: The type of the product</li><li>Quantity: The number of units ordered</li><li>Price: The price of one unit</li><li>OrderDate: The date when the order was placed</li><li>Shipped: Indicates whether the order has been shipped (Yes or No)</li><li>Country: The country from which the order was placed</li></ul><h4>Data Preprocessing</h4><p>The dataset does not have any null values but I added an extra column TotalPricewhich multiplies Quantityand Priceof the product. It will be easier for the EDA process.</p><pre>import polars as pl<br><br><br>url = &#39;https://raw.githubusercontent.com/nehanawar025/EDA-with-Polars-and-Plotly/refs/heads/main/orders.csv&#39;<br>data = pl.read_csv(url)<br><br><br>df = data.with_columns(<br>    (pl.col(&#39;Quantity&#39;) * pl.col(&#39;Price&#39;)).alias(&#39;TotalPrice&#39;)<br>)</pre><p>.with_columns() is used to add an extra column to the dataset, but it always adds the column at the end of the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vc0vyM5U7OuglCd6tMPGUg.png" /><figcaption>image by Author</figcaption></figure><h3>Analysis Begins</h3><h4>1. Which category generated the highest total revenue?</h4><pre>df.group_by(pl.col(&quot;Category&quot;)).agg(pl.col(&quot;TotalPrice&quot;).sum())</pre><p>df.group_by(pl.col(“Category”)).agg(pl.col(“TotalPrice”) This will group the data by category and sum up the total price according to the category.</p><pre>cat_list = category_price[&#39;Category&#39;].to_list()<br>price_list = category_price[&#39;TotalPrice&#39;].to_list()<br><br>pair = sorted(zip(price_list, cat_list), reverse = True)<br><br>sorted_list = [x for _, x in pair]<br><br><br>color_map = {sorted_list[0]: &quot;#565264&quot;}<br><br>for i in sorted_list[1:]:<br>    color_map[i] = &quot;#A7BCD1&quot;</pre><p>I wanted to give custom colors to my graph, so I created a color map.</p><p>pair = sorted(zip(price_list, cat_list), reverse = True)<br> Here, this creates a list and every element of this list is a tuple of price_list and cat_list. This list is sorted depending on the first element, which is price_list in descending order.</p><p>so pair would look like this: <br>[(3146.0, ‘Electronics’), (1993.0, ‘Furniture’), (434.0, ‘Stationery’)]</p><p>Now, this line sorted_list = [x for _, x in pair] will take only the category names from pair.</p><p>sorted_list would look like this:<br>[‘Electronics’, ‘Furniture’, ‘Stationery’]</p><pre>color_map = {sorted_list[0]: &quot;#565264&quot;}<br><br>for i in sorted_list[1:]:<br>    color_map[i] = &quot;#A7BCD1&quot;</pre><p>This color map takes the first element(sorted_list[0]), which has the highest total price and gives it a different color and the same color to the other categories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*vP_BrIZwWPBeiham8qcg3g.png" /><figcaption>image by Author</figcaption></figure><p>This clearly shows the <strong>Electronics</strong> category generates the highest revenue among the three categories.</p><h4>2. What percentage of total orders come from “Electronics” and what is its share in total revenue?</h4><pre>revenue = df[&#39;TotalPrice&#39;].sum()<br><br>elect_rev = df.filter(df[&quot;Category&quot;] == &#39;Electronics&#39;)[&#39;TotalPrice&#39;].sum()<br><br>elect_percent = (elect_rev/revenue) * 100.00<br>elect_percent</pre><pre>56.450744661762066</pre><p>So, the Electronics category is generating 56.45% of the total revenue.</p><pre>total_order = df[&#39;Quantity&#39;].sum()<br><br>elect_order = df.filter(df[&quot;Category&quot;] == &#39;Electronics&#39;)[&#39;Quantity&#39;].sum()<br><br>elect_order_percent = (elect_order/total_order) * 100.00<br>elect_order_percent</pre><pre>12.385321100917432</pre><p>The ‘Electronics’ category has only got 12.39% of the total order and with that it is generating 56.45% of the total revenue</p><h4>3. Overall, what are the top 5 ordered products and how much revenue do they generate?</h4><pre>top5_prod = df.group_by(<br>    pl.col(&#39;Product&#39;)<br>).agg(<br>    pl.col(&#39;Quantity&#39;).sum().alias(&quot;Total_Order&quot;), <br>    pl.col(&#39;TotalPrice&#39;).sum().alias(&quot;Total_Revenue&quot;)<br>).sort(<br>    [&quot;Total_Order&quot;], descending = True<br>).head()<br><br>top5_prod</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*bAD6EI8uqnZaEfKT3zqM2A.png" /><figcaption>Image by Author</figcaption></figure><h4>4. What is the price value for the shipped Vs not yet shipped per category?</h4><pre>ship_unship = df.group_by(<br>    pl.col(&quot;Category&quot;),<br>    pl.col(&quot;Shipped&quot;)<br>).agg(<br>    pl.col(&quot;TotalPrice&quot;).sum().alias(&quot;Total_Revenue&quot;)<br>).sort(<br>    pl.col(&quot;Total_Revenue&quot;), descending = True<br>)<br><br>ship_unship</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*SYroFaOw6pIYCRiYcbdZCQ.png" /><figcaption>Image by Author</figcaption></figure><h4>In Closing</h4><p>The codes and dataset are in the <a href="https://github.com/nehanawar025/EDA-with-Polars-and-Plotly"><em>Github</em></a><em> &amp; </em><a href="https://www.kaggle.com/code/nehanawar3/eda-with-polars-and-plotly-order-record-analysis"><em>Kaggle</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e8ffdf76c5a" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/eda-with-polars-and-plotly-order-record-analysis-9e8ffdf76c5a">EDA with Polars and Plotly: Order Record Analysis</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a dataset using Numpy]]></title>
            <link>https://medium.com/@noshinnawarneha/create-a-dataset-using-numpy-e53ca06e2f9d?source=rss-c8ba38c0cb1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e53ca06e2f9d</guid>
            <category><![CDATA[dataset]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[numpy]]></category>
            <dc:creator><![CDATA[Noshin Nawar Nawar]]></dc:creator>
            <pubDate>Sat, 24 Jan 2026 22:25:12 GMT</pubDate>
            <atom:updated>2026-01-24T22:48:27.758Z</atom:updated>
            <content:encoded><![CDATA[<h4>Basic Numpy to create a simple dataset</h4><p>Creating a dataset with numpy is very easy. You just have to create the column data and concatenate the columns together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nBQqr_vDRm2ZgOwf" /><figcaption>Image by Kreafolk</figcaption></figure><p>Let&#39;s take a simple example of a BMI dataset. We will need the following information: height, weight, BMI, and a label column indicating whether you are overweight or underweight.</p><p>First, we need to install Numpy and import it.</p><pre>import numpy as np</pre><p>Then, simply set the seed value for the random number generator, which will ensure that we obtain the same numbers for numpy arrays every time we run the script.</p><pre>np.random.seed(10)</pre><p>Now, I have used floating-point numbers, you can use integer numbers.</p><pre>height = np.random.uniform(1.4, 1.95, size=10).round(2)<br>weight = np.random.uniform(50, 100, size=10).round(2)</pre><p>I have used heights ranging from 1.4 meters to 1.95 meters and weights from 50 kg to 100 kg.</p><p>Now comes the BMI calculation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*_BJ9kLKgWZBBBaIn1Ze9NQ.png" /><figcaption>BMI formula</figcaption></figure><p>I divided this calculation into two parts. First, I calculated the height square, then I divided that by the weight.</p><pre>m_square = np.power(height, 2).round(2) <br><br>bmi = (weight/m_square).round(2)</pre><p>After getting the BMI, I categorized the BMI with labels. <br> 1. Underweight = 0<br> 2. Normal weight = 1<br> 3. Overweight = 2<br> 4. Obese = 3</p><pre>label = []<br>for i in bmi:<br>    if i&lt;18.5: <br>        label.append(0)<br>    elif i&gt;18.5 and i&lt;24.9:<br>        label.append(1)<br>    elif i&gt;25.0 and i&lt;29.9:<br>        label.append(2)<br>    else:<br>        label.append(3)<br><br>label = np.array(label)</pre><h4>Dataset with Numpy</h4><p>Now it&#39;s time to merge all the columns.</p><pre>data = np.column_stack((height, weight, bmi, label))</pre><h4>Full Code</h4><p><a href="https://gist.github.com/nehanawar025/d394d35c5fe07579c25a101255daedbe">dataset_with_numpy.py</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e53ca06e2f9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Black Friday Sales Analysis Using Polars and Plotly]]></title>
            <link>https://medium.com/learning-data/black-friday-sales-analysis-using-polars-and-plotly-e8101a4731e9?source=rss-c8ba38c0cb1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8101a4731e9</guid>
            <category><![CDATA[polars-dataframe]]></category>
            <category><![CDATA[plotly]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Noshin Nawar Nawar]]></dc:creator>
            <pubDate>Tue, 10 Sep 2024 07:44:23 GMT</pubDate>
            <atom:updated>2026-01-27T12:22:24.513Z</atom:updated>
            <content:encoded><![CDATA[<h3>EDA with Polars and Plotly: Black Friday Sales Analysis</h3><h4>Detailed analysis based on a particular scenario.</h4><p>Black Friday is an annual shopping event known for huge discounts and deals, primarily in the United States. It is the start of the holiday shopping season, and retailers provide great discount prices to attract customers.<br>For businesses, understanding the trends and behaviors of customers during this period is important for improving marketing strategies and increasing revenue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*_B5_AhO5_tNU68yU96ay6g.png" /><figcaption>AI Generated | Image by Author</figcaption></figure><h3>Objective</h3><p>As a Data Analyst at a retail company, my task is to analyze the company’s Black Friday sales data to better understand the purchasing behavior, including determining which age group plays a significant role in the sales. I also need to uncover the most popular product categories among this age group, as well as the factors like customer demographics, occupation, etc that influence their purchasing decisions.</p><h3>Dataset</h3><p>The dataset has information about customer’s gender, age groups, occupation, location info, marital status, product category and purchase amount. The dataset has total 550068 rows and 10 columns.The occupation, city_category, and product category are masked. This will allow us to analyze the data while keeping the original values private.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y5g-SScFE7bH_RLaWXEPYQ.png" /><figcaption>First 10 rows of the dataset | Image by Author</figcaption></figure><h4>Data Preprocessing</h4><p>The dataset has no null values. But the userID, occupation, marital status and product category columns are of integer datatype. To get proper plotting, I will convert these columns into string datatype.</p><pre>df = df.select(<br>    pl.col(&quot;User_ID&quot;).cast(pl.Utf8),<br>    pl.col(&quot;Product_ID&quot;),<br>    pl.col(&quot;Gender&quot;),<br>    pl.col(&quot;Age&quot;).alias(&quot;Age_groups&quot;),<br>    pl.col(&quot;Occupation&quot;).cast(pl.Utf8),<br>    pl.col(&quot;City_Category&quot;),<br>    pl.col(&quot;Stay_In_Current_City_Years&quot;),<br>    pl.col(&quot;Marital_Status&quot;).cast(pl.Utf8),<br>    pl.col(&quot;Product_Category&quot;).cast(pl.Utf8),<br>    pl.col(&quot;Purchase&quot;)<br>)<br><br>df</pre><p>pl.Utf8 is used for string datatype in Polars library. This will help to generate the desired dataset, which has 9 columns of categorical data and 1 column with integer data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*370TdAceu9cKxqev8yXS9w.png" /><figcaption>Dataset that will be used for further analysis | Image by Author</figcaption></figure><h3>Analysis Begins</h3><h4>Which age group has the highest number of customers?</h4><p>Determining which age group has the highest number of customers is one of the primary objective of this project. This finding will serve as a baseline for further analysis.</p><pre>customers_age_wise = (<br>    df.group_by([&#39;Age_groups&#39;])<br>    .agg(<br>        pl.col(&#39;User_ID&#39;).unique().count().alias(&#39;Total_customers&#39;)<br>    )<br>    .sort([&#39;Age_groups&#39;], descending=False)<br>)<br><br>sales_list = customers_age_wise[&#39;Total_customers&#39;].to_list()<br>age_list = customers_age_wise[&#39;Age_groups&#39;].to_list()<br><br><br>sorted_values = [x for _, x in sorted(zip(sales_list, age_list), reverse=True)]<br><br>color_map = {sorted_values[0]: &quot;#565264&quot;}<br><br>for i in sorted_values[1:]:<br>    color_map[i] = &quot;#A7BCD1&quot;<br><br><br><br>fig = px.bar(<br>    data_frame = customers_age_wise,<br>    x = &quot;Age_groups&quot;,<br>    y = &quot;Total_customers&quot;,<br>    title = &quot;Age group wise Total Customers&quot;,<br>    color_discrete_map = color_map,<br>    color = &#39;Age_groups&#39;<br>)<br><br>fig.update_traces(<br>    hovertemplate = <br>    &#39;&#39;&#39;&lt;b&gt;Age_group: %{x}&lt;/b&gt;<br>    &lt;br&gt;&lt;b&gt;Total_customers: %{y}&lt;/b&gt;&#39;&#39;&#39;<br>)<br><br>fig.update_layout(<br>    height = 450,<br>    width = 650,<br>    bargap = 0.25,<br>    xaxis_title = &quot;Age Groups&quot;,<br>    yaxis_title = None,<br>    showlegend = False<br>)<br><br>fig.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*Lq2KsdpSEIXksY0mpqoboA.png" /></figure><p>This plot is clearly showing that 26–35 age group has the highest number of customer.</p><h4>How much of the 26–35 age group is contributing compared to other age groups?</h4><pre>result1 = (<br>    df.group_by([&quot;Age_groups&quot;])<br>    .agg(<br>        Total_sales_per_age_groups = pl.col(&quot;Purchase&quot;).sum()<br>    )<br>    .sort([&quot;Age_groups&quot;], descending=False)<br>)<br><br><br>sales_list = result1[&#39;Total_sales_per_age_groups&#39;].to_list()<br>age_list = result1[&#39;Age_groups&#39;].to_list()<br><br><br>sorted_values = [x for _, x in sorted(zip(sales_list, age_list), reverse=True)]<br><br>color_map = {sorted_values[0]: &quot;#565264&quot;}<br><br>for i in sorted_values[1:]:<br>    color_map[i] = &quot;#A7BCD1&quot;<br><br><br>fig = px.bar(data_frame = result1,<br>    x = &quot;Age_groups&quot;,<br>    y = &quot;Total_sales_per_age_groups&quot;,<br>    color = &#39;Age_groups&#39;,<br>    color_discrete_map = color_map,<br>    title = &quot;Total Sales by Age Groups&quot;<br>    <br>)<br><br>fig.update_traces(<br>    hovertemplate = <br>    &#39;&#39;&#39;&lt;b&gt;Age Group: %{x}&lt;/b&gt;<br>    &lt;br&gt;&lt;b&gt;Total Sales: $%{y}&lt;/b&gt;&#39;&#39;&#39;<br>)<br><br>fig.update_layout(<br>    height = 450,<br>    width = 700,<br>    bargap = 0.25,<br>    yaxis_title = None,<br>    showlegend = False<br>)<br><br>fig.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*SbF3WBlrm7AITLNxIRnkNw.png" /></figure><p>The 26–35 age group outperforms other age groups not only in terms of consumer number but also in terms of overall revenues.</p><p>26–35 age group has total revenue of <strong>$2.03B</strong>. There is almost a $1B gap with the second biggest age group, 36–45.</p><h4>What is the Top 3 product category among male customers in the 26–35 age group compared to female customers in the same age group?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*inLEIQGDdMGM-xpFP3ruRQ.png" /></figure><p>For both male and female customers, the top 3 product categories are 1, 5, and 8.</p><pre>top_product_categories = result2_m[&quot;Product_Category&quot;].to_list()<br><br>result3 = (<br>    df.filter(<br>        (pl.col(&quot;Age_groups&quot;) == &#39;26-35&#39;) &amp;<br>        (pl.col(&quot;Product_Category&quot;).is_in(top_product_categories))<br>    )<br>    .group_by([&quot;Product_Category&quot;, &quot;Gender&quot;])<br>    .agg(<br>        Total_sales = pl.col(&quot;Purchase&quot;).sum()<br>    )<br>    .sort([&quot;Product_Category&quot;,&quot;Gender&quot;], descending=[False,True])<br>)<br><br><br><br>color_map = {&quot;M&quot;: &quot;#2986cc&quot;, &quot;F&quot;: &quot;#da627d&quot;}<br><br><br>fig = px.bar(data_frame = result3,<br>             x=&quot;Product_Category&quot;,<br>             y=&quot;Total_sales&quot;,<br>             color_discrete_map = color_map,<br>             color=&quot;Gender&quot;,<br>             barmode=&quot;group&quot;,<br>             title=&quot;Top Product Categories by Gender for 26-35 Age Group&quot;)<br><br><br>fig.update_traces(<br>    hovertemplate = <br>    &#39;&#39;&#39;&lt;b&gt;Product Category: %{x}&lt;/b&gt;<br>    &lt;br&gt;&lt;b&gt;Total Sales: %{y}&lt;/b&gt;&#39;&#39;&#39;<br>)<br><br>fig.update_layout(<br>    height = 450,<br>    width = 700,<br>    bargap = 0.2,<br>    yaxis_title = None<br>)<br><br>fig.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PgGIA5dC_ybL0grf2rqS_w.png" /></figure><p>However, for every category, there is a significant difference in the total revenue from male and female customers, with Product Category 1 being the most popular among both groups.</p><h4>Do customers in the 26–35 age group tend to purchase more from a specific occupation category?</h4><pre>occ_sales = (<br>    df.filter(pl.col(&#39;Age_groups&#39;) == &#39;26-35&#39;)<br>    .group_by(&#39;Occupation&#39;)<br>    .agg(pl.col(&#39;Purchase&#39;).sum().alias(&#39;Total_sales&#39;))<br>    .sort(&#39;Total_sales&#39;, descending=True)<br>)<br><br>occ_sales_list = occ_sales[&#39;Total_sales&#39;].to_list()<br>occ_uniq_list = occ_sales[&#39;Occupation&#39;].to_list()<br><br>occupation_values = [x for _, x in sorted(zip(occ_sales_list, occ_uniq_list), reverse=True)]<br><br><br><br>color_map = {occupation_values[0]: &quot;#565264&quot;}<br><br>for occ in occupation_values[1:]:<br>    color_map[occ] = &quot;#A7BCD1&quot;<br><br><br>    <br>fig = px.bar(<br>    data_frame=occ_sales,<br>    x=&quot;Occupation&quot;,<br>    y=&quot;Total_sales&quot;,<br>    color=&quot;Occupation&quot;,<br>    color_discrete_map=color_map,<br>    title=&quot;Total Sales by Occupation for 26-35 Age Group&quot;<br>)<br><br>fig.update_traces(<br>    hovertemplate=<br>    &quot;&quot;&quot;&lt;b&gt;Occupation: %{x}&lt;/b&gt;<br>    &lt;br&gt;&lt;b&gt;Total Sales: %{y}&lt;/b&gt;<br>    &quot;&quot;&quot;<br>)<br><br>fig.update_layout(<br>    height=450,<br>    width=800,<br>    bargap=0.2,<br>    yaxis_title=None,<br>    showlegend=False<br>)<br><br>fig.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4eG2ULVTMOToeht_yE1wbw.png" /></figure><p>Customers from other occupations also contributed to the total sales, but the customers from the ‘0’ occupation category contributed the most with <strong>$311.7 million</strong>.</p><h4>What is the distribution of purchases across Top 3 product categories for customers in the 26–35 age group who are married vs. unmarried?</h4><pre>top_product = result5_u[&quot;Product_Category&quot;].to_list()<br><br>result5 = (<br>    df.filter(<br>        (pl.col(&quot;Age_groups&quot;) == &#39;26-35&#39;) &amp;<br>        (pl.col(&quot;Product_Category&quot;).is_in(top_product))<br>    )<br>    .group_by([&quot;Product_Category&quot;, &quot;Marital_Status&quot;])<br>    .agg(<br>        Total_sales = pl.col(&quot;Purchase&quot;).sum()<br>    )<br>    .sort([&quot;Product_Category&quot;,&quot;Marital_Status&quot;], descending=False)<br>)<br><br><br><br>color_map = {&quot;0&quot;: &quot;#9A3D4F&quot;, &quot;1&quot;: &quot;#7E9171&quot;}<br><br><br><br>fig = px.bar(data_frame = result5)<br>             x=&quot;Product_Category&quot;,<br>             y=&quot;Total_sales&quot;,<br>             color_discrete_map = color_map,<br>             color=&quot;Marital_Status&quot;,<br>             barmode=&quot;group&quot;,<br>             title=&quot;Top Product Categories by Marital Status for 26-35 Age Group&quot;)<br><br>fig.update_traces(<br>    hovertemplate = <br>    &#39;&#39;&#39;&lt;b&gt;Product Category: %{x}&lt;/b&gt;<br>    &lt;br&gt;&lt;b&gt;Total Sales: %{y}&lt;/b&gt;&#39;&#39;&#39;<br>)<br><br>fig.update_layout(<br>    height = 450,<br>    width = 700,<br>    bargap = 0.2,<br>    yaxis_title = None<br>)<br><br>fig.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tpheCtW1jVgxGLuMd5GMCA.png" /></figure><p>The bar chart shows that unmarried individuals (0) tend to purchase more in all top categories, with Product Category 1 being the most popular among both married and unmarried groups.</p><h3>In Closing</h3><p>All the codes and resources are in the <a href="https://github.com/nehanawar025/EDA-BLACK-FRIDAY-SALES"><em>Github</em></a>.</p><p><em>The contents of external submissions are not necessarily reflective of the opinions or work of </em><a href="http://mavenanalytics.io/"><em>Maven Analytics</em></a><em> or any of its team members.</em></p><p><em>We believe in fostering lifelong learning and our intent is to provide a platform for the data community to share their work and seek feedback from the Maven Analytics data fam.</em></p><p><a href="https://medium.com/learning-data/how-to-get-your-work-published-by-learning-data-with-maven-analytics-7df21e466a3e?source=friends_link&amp;sk=020dfac485597d602e218968d9ffb395"><em>Submit your own writing here</em></a><em> if you’d like to become a contributor.</em></p><p><em>Happy learning!</em></p><p><em>-Team Maven</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8101a4731e9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/learning-data/black-friday-sales-analysis-using-polars-and-plotly-e8101a4731e9">Black Friday Sales Analysis Using Polars and Plotly</a> was originally published in <a href="https://medium.com/learning-data">Learning Data</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[184. Department Highest Salary -LeetCode]]></title>
            <link>https://blog.devops.dev/184-department-highest-salary-leetcode-54ec23f96fc0?source=rss-c8ba38c0cb1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/54ec23f96fc0</guid>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[leetcode-medium]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Noshin Nawar Nawar]]></dc:creator>
            <pubDate>Thu, 29 Aug 2024 08:17:38 GMT</pubDate>
            <atom:updated>2024-09-09T04:58:25.450Z</atom:updated>
            <content:encoded><![CDATA[<h4>Question, Solution, and the Process behind it.</h4><p>This is a <a href="https://leetcode.com/problems/department-highest-salary/description/">LeetCode <strong>Medium</strong> question</a>.</p><h3>Question</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TeCapkn0xrJ75iF2JwpG8w.png" /><figcaption>Question from LeetCode | Image by Author</figcaption></figure><h3>Solution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vs8HtIpUAbdKrzeecYHPbQ.png" /><figcaption>Solution by Author</figcaption></figure><h3>Process</h3><p>First, let&#39;s discuss the wrong solution:</p><pre>SELECT <br>    d.name as Department,<br>    e.name as Employee,<br>    MAX(e.salary) as Salary<br>FROM<br>    employee e<br>    JOIN department d ON e.departmentId = d.id<br>GROUP BY<br>    e.departmentId</pre><p>This is a wrong solution because although it will calculate the maximum salary for each group, it will not correctly match the employee’s name with the maximum salary for that department.</p><p>The resultant table will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*RtifvSsG4pjKnYsjMDQmRg.png" /><figcaption>Wrong answer</figcaption></figure><p>If you match this table with the input table you will notice that Joe doesn’t even get 90000! He gets 70000. <br>This means that the query did not get the right records.</p><p>The following code can help fix this:</p><pre>SELECT <br>    d.name as Department,<br>    e.name as Employee,<br>    e.salary as Salary<br>FROM<br>    (SELECT *, MAX(Salary) OVER(PARTITION BY departmentId) AS max_salary<br>    FROM Employee) e<br>    JOIN Department d<br>    ON e.DepartmentId = d.Id<br>where<br>    salary = max_salary</pre><p>Let’s break down MAX(Salary) OVER(PARTITION BY DepartmentId) AS max_salary</p><p>PARTITION BY DepartmentId<strong> </strong>line has divided the data into smaller tables with the employees from one dept. So, there will be 2 smaller tables now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z4zG1KFzhnWCeeFcTY25Ow.png" /><figcaption>smaller table for each dept.</figcaption></figure><p>The key difference between the aggregate function (like <em>MAX(Salary)</em> with <em>GROUP BY) </em>and the window function is that it does not reduce the number of rows for showing the result. Instead,MAX(Salary) OVER() AS max_salary<strong> </strong>will calculate the maximum salary for each smaller table, create a new column named max_salary, and add the maximum salary to each row in the original data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jtzuH0Khn-4U8Tdjc2D4sA.png" /></figure><p>After combining these smaller tables:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*mkh0WLF5JW68BOztU1KJkQ.png" /><figcaption>Resultant Employee table</figcaption></figure><p>Now this Employee the table will be joined with Department table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_uNfUgS-iVVow_LoeufAXQ.png" /></figure><p>Then we just need to get those rows where salary = max_salary</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*Z6ritFFXwOXNSe9Akl2vwA.png" /><figcaption>The real resultant table</figcaption></figure><h4>In Closing</h4><p>I hope it will be helpful!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54ec23f96fc0" width="1" height="1" alt=""><hr><p><a href="https://blog.devops.dev/184-department-highest-salary-leetcode-54ec23f96fc0">184. Department Highest Salary -LeetCode</a> was originally published in <a href="https://blog.devops.dev/">DevOps.dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[574. Winning Candidate — LeetCode]]></title>
            <link>https://blog.devops.dev/574-winning-candidate-leetcode-50b9bb8ed3f5?source=rss-c8ba38c0cb1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/50b9bb8ed3f5</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[leetcode-medium]]></category>
            <category><![CDATA[leetcode]]></category>
            <dc:creator><![CDATA[Noshin Nawar Nawar]]></dc:creator>
            <pubDate>Wed, 28 Aug 2024 11:00:13 GMT</pubDate>
            <atom:updated>2024-08-29T17:44:44.795Z</atom:updated>
            <content:encoded><![CDATA[<h3>574. Winning Candidate — LeetCode</h3><h4>Question, Solution and the Process behind it.</h4><p>This is a <strong>medium-level</strong> question.</p><h3>Question</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B9xC6ooW2mGQwWYKek9YJQ.png" /><figcaption>Question from LeetCode | Image by Author</figcaption></figure><h3>Solution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DfQpuBdIWSBiSGSdTBPwow.png" /><figcaption>Solution by Author</figcaption></figure><h3>Process</h3><p>I started by joining the <strong>Vote</strong> table with the <strong>Candidate</strong> table using a <strong>LEFT JOIN</strong> to link each vote to its respective candidate. After the join the table will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hvPcz5HXQyU77OrtPVrD1Q.png" /><figcaption>Table after left join</figcaption></figure><p><strong>GROUP BY NAME</strong> Groups the results by candidate names, which is necessary to count the votes for each candidate.</p><p>Then the <strong>ORDER BY COUNT(NAME) DESC </strong>orders the list of candidate name by count of votes in descending order, ensuring the candidate with the most votes appears at the top.</p><p>Then to get the name of the candidate with highest vote I used the <strong>LIMIT 1</strong></p><h4>In Closing</h4><p>I hope it will be helpful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50b9bb8ed3f5" width="1" height="1" alt=""><hr><p><a href="https://blog.devops.dev/574-winning-candidate-leetcode-50b9bb8ed3f5">574. Winning Candidate — LeetCode</a> was originally published in <a href="https://blog.devops.dev/">DevOps.dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Singular and Non-singular Matrix in Machine Learning in 3 Minutes]]></title>
            <link>https://medium.com/@noshinnawarneha/singular-and-non-singular-matrix-in-machine-learning-in-3-minutes-9f9b58b51c43?source=rss-c8ba38c0cb1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f9b58b51c43</guid>
            <category><![CDATA[linear-algebra]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[matrix]]></category>
            <category><![CDATA[coursera]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Noshin Nawar Nawar]]></dc:creator>
            <pubDate>Sun, 25 Aug 2024 05:49:36 GMT</pubDate>
            <atom:updated>2024-08-30T11:51:18.999Z</atom:updated>
            <content:encoded><![CDATA[<h4>Save 2 hours with this quick article simplifying Week 1 of the Linear Algebra for Machine Learning course from Deeplearning.AI!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Bf-YHAPqyUPNVGmgb8vQA.jpeg" /><figcaption>Image of the Course</figcaption></figure><p>This is one of the <a href="https://www.coursera.org/learn/machine-learning-linear-algebra">best courses</a> for beginners who want to learn about linear algebra to excel in machine learning. <a href="https://www.youtube.com/@SerranoAcademy"><strong>Luis Serrano</strong></a> is a great instructor who simplifies each and every concept. My learnings from week 1 were great but soon I realized it shouldn’t take 2 hours to get to the point!</p><p>So, I’ve written this article to save you 2 hours to learn the concepts quickly and effectively.</p><p>But before determining if the matrix is singular or non-singular, let me tell you why it is even more important to know about the singularity and non-singularity of a matrix in machine learning.</p><h3>Why Does it Matter?</h3><p>Though the singularity of a matrix effects calculation involves linear algebra, which is fundamental for many ML algorithms, it does not cover ‘<strong>Why it is important</strong>’ in the week 1 material. That’s why I am listing some important points about why it matters:</p><ol><li>Principal Component Analysis (PCA) is a technique used to reduce the number of features in a dataset while retaining as much important information as possible. PCA does this by finding new features, called principal components.<br>To find these principal components, PCA first computes the covariance matrix of the dataset. The covariance matrix shows how the features in the dataset are related to each other. A covariance matrix is considered singular if the determinant of the matrix is 0, meaning it’s not invertible. This usually happens when there is redundancy in the data, meaning it doesn’t add any new information beyond what’s already captured by other features in the dataset. <br>So, you can then safely remove these redundant features, simplifying the model and making it more efficient.</li><li>In many machine learning algorithms, particularly those involving linear regression or optimization, we need to solve linear systems of equations of the form ‘Ax=b’.<br>If matrix A is non-singular (i.e., the determinant of A matrix is non-zero), it has an inverse, and the system has a unique solution.<br>If A is singular (i.e., the determinant of A matrix is zero), it doesn’t have an inverse, meaning the system may have either no solution or infinitely many solutions, leading to complications in finding a unique solution.</li></ol><h3>Determinant of Matrix</h3><p>To solve whether the matrix is singular or non-singular, there are many ways, as shown in the course, i.e., we can derive lines and planes from the system of equations or we can check if the rows of the matrix are linearly dependent on each other or not.</p><p>However, the easiest and most effective way is to find the determinant of the matrix.</p><h4>Determinant of 2x2 Matrix</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*ioOrguefmb5VHxXnDDWcIw.png" /><figcaption>Steps to get the determinant of 2x2 matrix | Image by author</figcaption></figure><p>The simple rule is to find the <strong>ad-bc </strong>of the given matrix. If the answer is 0, it will be singular; if the answer is non-zero, it is non-singular.</p><h4>Determinant of 3x3 Matrix</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4HWKZAFwGg7cfLR2u2Hfdw.png" /><figcaption>Steps to get the determinant of 3x3 matrix | Image by author</figcaption></figure><p>At first, you have to arrange the matrix sequence by putting the first two columns as they are after writing the given 3x3 matrix. <br>Then, diagonally, we have to take 3 numbers, as shown in the picture with the green color, and then subtract the red diagonal numbers from the green ones.</p><p>Again, if the answer is zero, it will be singular; if the answer is non-zero, it is non-singular.</p><h3>In Closing</h3><p>Learning math for machine learning is a bit overwhelming, but it is a must. I hope this article has helped you a little bit.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f9b58b51c43" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SQL 50 Basic Select — Day 1]]></title>
            <link>https://medium.com/@noshinnawarneha/sql-50-basic-select-day-1-185d1982ff4d?source=rss-c8ba38c0cb1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/185d1982ff4d</guid>
            <category><![CDATA[100daysofcode]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[data-analysis]]></category>
            <dc:creator><![CDATA[Noshin Nawar Nawar]]></dc:creator>
            <pubDate>Sat, 17 Aug 2024 06:30:23 GMT</pubDate>
            <atom:updated>2024-08-17T07:17:17.995Z</atom:updated>
            <content:encoded><![CDATA[<h3>SQL 50 Basic Select — Day 1</h3><h4>Solve and explaination of the the select section</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yeUQRubeJLFLKklfN7kh5w.png" /><figcaption>Generated by AI | Image by Author</figcaption></figure><p>SQL is the standard language for accessing and manipulating databases and learning SQL is important for the data analysis curriculum.<br>So, in this blog, I will solve the basic problems of SQL 50 list.</p><h3>Solving the Problems</h3><h4><a href="https://leetcode.com/problems/recyclable-and-low-fat-products/description/">1757. Recyclable and Low Fat Products</a></h4><pre>select<br>    product_id<br>from<br>    products<br>where<br>    low_fats = &#39;Y&#39; <br>    and recyclable = &#39;Y&#39;</pre><h4>Explaination</h4><p>As the products needs to be low fat and recyclable, that is why both needs to set to ‘Y’</p><h4><a href="https://leetcode.com/problems/find-customer-referee/description/">584. Find Customer Referee</a></h4><pre>select <br>    name<br>from<br>    customer<br>where <br>    referee_id != &#39;2&#39; or referee_id is null</pre><h4>Explaination</h4><p>There are null values in the column, so it is important to put two conditions.</p><p>which are:</p><ul><li>ID should not be &#39;2&#39; (this will collect the ID ‘1’s)</li><li>ID should not be null as well</li></ul><h4><a href="https://leetcode.com/problems/big-countries/">595. Big Countries</a></h4><pre>select<br>    name, population, area<br>from <br>    world<br>where<br>    area &gt;= 3000000<br>    or population &gt;= 25000000</pre><h4>Explaination</h4><p>when the ‘at least’ term is mentioned, it means it needs to be greater or equal. In this example, the area has to be at least 3M km2 or the population has to be at least 25M.</p><h4><a href="https://leetcode.com/problems/article-views-i/description/">1148. Article Views I</a></h4><pre>select <br>    distinct author_id as id<br>from<br>    views<br>where<br>    author_id = viewer_id<br>order by <br>    author_id</pre><h4>Explaination</h4><p>Where clause works at row-level, means it will go to each row to see if the condition is satisfied or not. But the ‘distinct’ keyword is important because if I don’t use it, it will show duplicate row like the picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/114/1*zTLfZX5PAMOsKlDAK-UsVw.png" /></figure><h4><a href="https://leetcode.com/problems/invalid-tweets/">1683. Invalid Tweets</a></h4><pre>select <br>    tweet_id <br>from<br>    Tweets<br>where<br>    CHAR_LENGTH(content) &gt; 15</pre><h4>Explaination</h4><p>Tweet validation is based on the length of the content. If it is greater than 15, then it invalid tweet, and to get the list of invalid tweet ‘CHAR_LENGTH(content) &gt; 15’ is applied</p><h3>In Closing</h3><p><a href="https://leetcode.com/studyplan/top-sql-50/">SQL 50</a> is a curated set of fundamental SQL problems designed to practice database querying skills. By working through these problems, we will practical experience in writing efficient SQL queries and develop a deeper understanding of database operations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=185d1982ff4d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Exploratory Data Analysis using MySQL to find the perfect Airbnb]]></title>
            <link>https://medium.com/learning-data/an-exploratory-data-analysis-using-mysql-to-find-the-perfect-airbnb-1aaba2b02b9b?source=rss-c8ba38c0cb1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1aaba2b02b9b</guid>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[airbnb]]></category>
            <dc:creator><![CDATA[Noshin Nawar Nawar]]></dc:creator>
            <pubDate>Thu, 15 Aug 2024 17:35:18 GMT</pubDate>
            <atom:updated>2024-08-17T03:24:43.041Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Follow this guide to </strong>Discover how you can save up to €500 while getting top-reviewed Airbnbs</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rndunz9ZCVKrPxiqFP-yCg.jpeg" /><figcaption><a href="https://images.unsplash.com/photo-1467269204594-9661b134dd2b">photo from Unsplash</a></figcaption></figure><p>When planning a family trip, it is important to manage a living budget. After all, accommodation is one of the largest expenses, and striking the right balance between comfort and cost is essential for enjoying the trip without breaking the bank.</p><p>This is where Airbnb comes in as a popular choice for families. Unlike traditional hotels, Airbnb offers the flexibility of having a kitchen, multiple bedrooms, and a living space, meaning families can enjoy their home&#39;s comforts while exploring a new city. Plus, the variety of listings ensures something for everyone, making it easier for families to find a place that fits their needs and wallets.</p><h3>Objective</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q4MHx5ny8I3mfsuS06AXHQ.png" /><figcaption><a href="https://storyset.com/illustration/asian-family/bro">Illustration of a family</a></figcaption></figure><p>Meet Mr. Harry and his family. They live in Malaysia. Though he has traveled to Singapore and Hong Kong before, he has always stayed at his relatives&#39; or friends’ houses while on trips. Now he is planning to visit Berlin for the first time and wants to find an Airbnb that suits his plan perfectly.</p><p>So, in my latest data analysis project, my goal is to assist Mr. Harry and his family in finding the perfect Airbnb that suits their preferences and budget by analyzing various factors such as price, location, and reviews. I want to simplify his finding process so that he does not have to worry about finding a suitable place to stay.</p><h3>Requirements</h3><p>They have some requirements for the project in terms of finding a place:</p><ol><li>The family wants to rent an Airbnb that is within their budget and well-reviewed.</li><li>They would like to see the average prices first, and as per the average prices, they are open to adjusting their budget of €120 per night if needed.</li><li>They prefer renting an entire apartment or a hotel room as a family.</li><li>They need the Airbnb to be available for a continuous 10-day stay.</li><li>They are particularly interested in popular neighborhoods like Mitte, Friedrichshain-Kreuzberg, Pankow, or Neukölln.</li></ol><h3>Dataset</h3><p>The <a href="https://insideairbnb.com/get-the-data/">Inside Airbnb</a> website offers seven different files for each city or region. And the best thing about this website is that the datasets are updated every once in a while. So this is the best resource to get an up-to-date dataset to do projects with. This dataset was last updated on <strong>June 22, 2024</strong>. After reviewing the project requirements, I started with the ‘listings.csv’ file. This file contains information and key metrics for listings in Berlin, Germany. The dataset contains 13759 rows and 18 columns. An added benefit is that it comes with a <a href="https://docs.google.com/spreadsheets/d/1iWCNJcSutYqpULSQHlNyGInUvHg2BoUGoNRIGa6Szc4/edit?gid=1322284596#gid=1322284596">data dictionary</a> for the listings in this CSV file.</p><h3>Data Preprocessing</h3><p>The updated CSV file is clean and formatted. I did not have any problem with that. However, I faced some problems while importing the data from my local drive to MySQL Workbench. <br>There are some tools available for that: MySQLdb, MySqlConnector, and PyMySQL.</p><p>Firstly, I was using MySQLdb and constantly getting errors. Then I googled the problem and in a Youtube video, it showed MySqlConnector will solve the problem. Again, nothing happened. Lastly, the problem was solved by the PyMySQL package. I am not saying this is the best package. Try and see what works for you.</p><p>First, create a database in MySQL. I named it ‘airbnb_analysis’. You can use any name of your choice. This name will be used in the code as well.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6a53f59964b2d0efeada7dd393f9fe72/href">https://medium.com/media/6a53f59964b2d0efeada7dd393f9fe72/href</a></iframe><h3>Analysis Begins</h3><h4>Number of Listings and Average Prices by Room Type in Popular Neighborhoods</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9715a948b4c8e9ccad86ce55b1b55e9d/href">https://medium.com/media/9715a948b4c8e9ccad86ce55b1b55e9d/href</a></iframe><p>Here I searched for the listings and their average prices in the famous neighborhoods, as it will be helpful for Mr. Harry to get an idea about the prices and fix the budget for further analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2sqex-nvY9ZG0AdKFccCnA.png" /><figcaption>Number of Listings and Average Prices by Room Type in Popular Neighborhoods</figcaption></figure><p><strong>Recommendation</strong></p><p>As there are lots of listings that are around €120, I suggested going with the initial budget, which is €120/night.</p><h4>Total Number of Apartments and Hotel Rooms Available Under €120 in Preferred Neighborhoods</h4><p>Mr. Harry preferred apartments and hotel rooms. So I wanted to see the total number of apartments and hotels that are available under €120, and the number was surprisingly high.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/72eab19cfc8837ee6f3a682851bd266f/href">https://medium.com/media/72eab19cfc8837ee6f3a682851bd266f/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PZwtKIDnEtoNDILFLV1MYQ.png" /><figcaption>Total Number of Apartments and Hotel Rooms Available Under €120 in Preferred Neighborhoods</figcaption></figure><p><strong>Recommendation</strong></p><p>As there are lots of options for apartments compared to hotel rooms, I advised him to focus only on the apartments for a better selection within the budget.</p><h4>Total Number of Listings by 10-Day Price Range (Available for at Least 50 Days for the next 1 Year)</h4><p>Now my findings will be limited to apartments under €120/night (€1200/10 days). Although Mr. Harry is only looking for a continuous 10-day stay, I will focus on finding apartments that are available for <strong>at least 50 days</strong> from June 22, 2024 (the last updated day of the dataset) to June 22, 2025.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a8a8b7cccf374a96fb0bca3e1a5f926/href">https://medium.com/media/7a8a8b7cccf374a96fb0bca3e1a5f926/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VFmKe7l0_JdB8PbjoUoj_w.png" /><figcaption>Total Number of Listings by 10-Day Price Range in Preferred Neighborhoods</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*_wQ7NAS9uUZuB2Te4bS5qA.png" /><figcaption>Number of Listings by 10-Day Price Range</figcaption></figure><p><strong>Recommendation</strong></p><p>Although the budget of €1200 for 10 days was fixed initially, I recommended considering the <strong>€260–€700</strong> range instead, as it also offers a lot of options and allows for better cost management.</p><h4>Curated List of Highly Reviewed Apartments in Berlin within the €260–€700 Range</h4><p>This is the most-awaited last part of the analysis. But it is done in two parts:</p><ol><li>First, I gathered information about the maximum review for the €260–€700 price range. Though the maximum review number was 520, I rounded that to 600 as the highest review and took the top 15 review numbers. Now the review range becomes <strong>260–600</strong>.</li></ol><p>2. After getting the review range and maintaining all the client requirements, I got the list of 15 available apartments.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a30c8896c3056d539a72a2ade97bbe82/href">https://medium.com/media/a30c8896c3056d539a72a2ade97bbe82/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hJvMMih4i3maimO5KFuCkA.png" /><figcaption>Review range and Curated List of Highly Reviewed Apartments</figcaption></figure><p>To ensure a smooth and enjoyable trip, it is important to carefully select accommodations that align with his budget, preferences, and availability. This analysis reduced the list from <strong>13,759 to just 15 listings </strong>while bringing the <strong>budget down by up to €500</strong> from the initially fixed budget.</p><h3>In Closing</h3><p>Thank you for taking the time to read through this analysis. All the codes are also listed in my <a href="https://github.com/nehanawar025/Finding_Airbnb_using_MySQL">Github</a>.</p><p><em>The contents of external submissions are not necessarily reflective of the opinions or work of </em><a href="http://mavenanalytics.io/"><em>Maven Analytics</em></a><em> or any of its team members.</em></p><p><em>We believe in fostering lifelong learning and our intent is to provide a platform for the data community to share their work and seek feedback from the Maven Analytics data fam.</em></p><p><a href="https://medium.com/learning-data/how-to-get-your-work-published-by-learning-data-with-maven-analytics-7df21e466a3e?source=friends_link&amp;sk=020dfac485597d602e218968d9ffb395"><em>Submit your own writing here</em></a><em> if you’d like to become a contributor.</em></p><p><em>Happy learning!</em></p><p><em>-Team Maven</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1aaba2b02b9b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/learning-data/an-exploratory-data-analysis-using-mysql-to-find-the-perfect-airbnb-1aaba2b02b9b">An Exploratory Data Analysis using MySQL to find the perfect Airbnb</a> was originally published in <a href="https://medium.com/learning-data">Learning Data</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploratory Analysis of Car Evaluation Dataset with SQL]]></title>
            <link>https://medium.com/noshin-nawar-neha-data-analytics-blogs/exploratory-analysis-of-car-evaluation-dataset-with-sql-d67e6d93262e?source=rss-c8ba38c0cb1e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d67e6d93262e</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[exploratory-data-analysis]]></category>
            <category><![CDATA[data-analysis]]></category>
            <dc:creator><![CDATA[Noshin Nawar Nawar]]></dc:creator>
            <pubDate>Sat, 03 Feb 2024 16:07:44 GMT</pubDate>
            <atom:updated>2024-08-15T22:49:06.404Z</atom:updated>
            <content:encoded><![CDATA[<p>This project aims to conduct a comprehensive analysis of the car evaluation dataset in MySQL. This project focuses on identifying patterns and trends across various attributes to gain data-driven insights.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CCSE5xPoLv7RfTc_tC9-zg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@sooprun?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Alex Suprun</a> on <a href="https://unsplash.com/photos/selective-focus-photography-of-assorted-color-vehicles-A53o1drQS2k?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><h3>Dataset Overview</h3><p>The data used in this project has been taken from the UCI Machine Learning Repository. The <a href="https://archive.ics.uci.edu/dataset/19/car+evaluation">Car Evaluation Database</a> was derived from a simple hierarchical decision model originally developed for the demonstration of DEX, M. Bohanec, and V. Rajkovic.</p><p>There are six attributes and one target column containing all the listed cars&#39; information. There are no missing values in any of the dataset’s 1728 total instances.</p><p>The columns are:</p><p>buying → Buying price</p><p>maint → Price of the maintenance</p><p>doors → Number of doors</p><p>persons → Capacity in terms of persons to carry</p><p>lug_boot → the size of the luggage boot</p><p>safety → estimated safety of the car</p><p>class → Evaluation level (unacceptable, acceptable, good, very good)</p><h3>Questions and Key Insights</h3><p>I prepared some questions for my analysis.</p><h4>How are the cars distributed in terms of buying price?</h4><pre>SELECT buying as Buying_Price, count(*) as Number_of_Cars<br>from car_evaluation<br>group by buying;</pre><p><strong>Result</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/289/1*2o5f25w973ZybmxE8ZvvNg.png" /><figcaption>Result based on buying price</figcaption></figure><h4>How is the safety level distributed among the cars in the dataset?</h4><pre>SELECT Safety as Safety_Level, count(*) as Number_of_Cars<br>from car_evaluation<br>group by Safety;</pre><p><strong>Result</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/1*58rmOWH_alvjbb1Z7sGYgw.png" /><figcaption>Result based on Safety Levels</figcaption></figure><h4>How are the cars distributed in terms of maintenance costs?</h4><pre>SELECT maint as Maintenance_Cost, count(*) as Number_of_Cars<br>from car_evaluation<br>group by maint;</pre><p><strong>Result</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*P8d01sNC8ntn57emO3FXSg.png" /><figcaption>Result based on maintenance cost</figcaption></figure><h4>What is the distribution of the capacity of cars in terms of the number of people they can carry?</h4><pre>SELECT Persons as Passenger_Capacity, count(*) as Number_of_Cars<br>from car_evaluation<br>group by Persons;</pre><p><strong>Result</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*PqZ59Scc6928fSq7Z7zFJg.png" /><figcaption>Result based on 2 and 4 seater cars</figcaption></figure><h4>How does the size of the luggage boot vary across different cars?</h4><pre>SELECT Lug_boot as Luggage_Boot_Size, count(*) as Number_of_Cars<br>from car_evaluation<br>group by Lug_boot;</pre><p><strong>Result</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*PvrJ2sm2ZAZUieqY3bQXWQ.png" /><figcaption>Result based on boot size</figcaption></figure><h4>What is the distribution of cars with high safety levels and a passenger capacity of 4, categorized by buying price and maintenance cost?</h4><pre>SELECT Buying AS Buying_Price, Maint AS Maintenance_Cost , count(*) as Number_of_Cars<br>FROM car_evaluation<br>WHERE safety = &#39;high&#39; AND persons = 4<br>GROUP BY Buying, Maint;</pre><p><strong>Result</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*S-cm7JBMR_D0AOb-GSTOoQ.png" /><figcaption>Buying price + Maintenance cost Vs No. of cars</figcaption></figure><h4>Are there specific buying price and maintenance cost ranges associated with more favorable evaluation levels?</h4><pre>select buying as Buying_Price, maint as Maintenance_Cost,<br>avg(case when class = &#39;good&#39; or class = &#39;vgood&#39; then 1 else 0 end) as Favorable_Evaluation_Percentage<br>from car_evaluation<br>group by buying, maint<br>order by Favorable_Evaluation_Percentage desc;</pre><h4>Result</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*iAUiYwHtXmwJPqaVZm98bg.png" /></figure><p><strong>Key Insights</strong></p><ol><li>Low and mid-range buying prices have more demand.</li><li>Despite high maintenance costs, cars are in demand on the market for their inexpensive price.</li></ol><h4>Which combination of buying price and maintenance cost seems to be most important in determining whether a car is evaluated as “unacceptable”?</h4><pre>select buying as Buying_Price, maint as Maintenance_Cost,<br>avg(CASE WHEN class = &#39;unacc&#39; THEN 1 ELSE 0 END) as Unacceptable_Rate<br>from car_evaluation<br>group by buying,maint;</pre><p><strong>Result</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*Uwk7e0f7GvTCxLs4GFcucw.png" /></figure><p><strong>Key Insights</strong></p><p>Whenever there is a high or very high buying price, maintenance cost, or both, it has the highest unaccepted rate.</p><h4>How many cars in the dataset meet the dream car specifications, which include a buying price of ‘med’ or ‘low’, maintenance cost of ‘med’ or ‘low’, high safety level, a capacity for four persons, four doors, a luggage boot size of ‘med’ or ‘big’, and an evaluation class of ‘vgood’ or ‘good’?</h4><pre>select count(*) as Number_of_Cars<br>from car_evaluation<br>where<br>buying in (&#39;med&#39;,&#39;low&#39;)<br>and maint in (&#39;med&#39;,&#39;low&#39;)<br>and safety = &#39;high&#39;<br>and persons = 4<br>and Doors = 4<br>and lug_boot in (&#39;med&#39;, &#39;big&#39;)<br>and class in (&#39;vgood&#39;, &#39;good&#39;)</pre><p><strong>Result</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/192/1*u1LPW5Je-fR6KAtODeWVNw.png" /><figcaption>No of ‘Dream Car’</figcaption></figure><h4>In Closing</h4><p>In this analysis, I gained some key insights into the distribution of cars based on various attributes. Additionally, I also explored the associations between buying price, maintenance cost, and evaluation levels, emphasizing safety, passenger capacity, and the customer’s choice.</p><p>You can find the codes → <a href="https://github.com/nehanawar025/Exploratory-Analysis-of-Car-Evaluation-Dataset-with-SQL">Github</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d67e6d93262e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/noshin-nawar-neha-data-analytics-blogs/exploratory-analysis-of-car-evaluation-dataset-with-sql-d67e6d93262e">Exploratory Analysis of Car Evaluation Dataset with SQL</a> was originally published in <a href="https://medium.com/noshin-nawar-neha-data-analytics-blogs">Noshin Nawar Neha — Data &amp; Analytics Blogs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>