<?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 Kshama Singhal on Medium]]></title>
        <description><![CDATA[Stories by Kshama Singhal on Medium]]></description>
        <link>https://medium.com/@kshamasinghal?source=rss-4a27dccb1e8b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wVmG3DjcE9XQQv-isgHeVw.jpeg</url>
            <title>Stories by Kshama Singhal on Medium</title>
            <link>https://medium.com/@kshamasinghal?source=rss-4a27dccb1e8b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 20:17:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kshamasinghal/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[8 Week SQL Challenge — Case Study #2 — Pizza Runner (B)]]></title>
            <link>https://medium.com/@kshamasinghal/8-week-sql-challenge-case-study-2-pizza-runner-b-9034689f92b?source=rss-4a27dccb1e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9034689f92b</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[mysql-workbench]]></category>
            <category><![CDATA[common-table-expressions]]></category>
            <category><![CDATA[sql-window-functions]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Kshama Singhal]]></dc:creator>
            <pubDate>Wed, 03 May 2023 15:14:25 GMT</pubDate>
            <atom:updated>2023-05-06T06:25:21.789Z</atom:updated>
            <content:encoded><![CDATA[<h3>8 Week SQL Challenge — Case Study #2 — Pizza Runner (B)</h3><blockquote>Runner and Customer Experience</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/0*2WCb9TdnIdW1bU3v.png" /></figure><p>We will use MYSQL Workbench for solving this case study. You can see this case study here: <a href="https://8weeksqlchallenge.com/case-study-2/">https://8weeksqlchallenge.com/case-study-2/</a></p><p>This blog is the continuation of the <a href="https://medium.com/jovianml/8-week-sql-challenge-case-study-2-pizza-runner-5899386d9519">8 Week SQL Challenge- Case Study #2- Pizza Runner</a>.</p><p>Let’s have an overview of the tables:</p><h4>Table 1: runners</h4><p>The runners table shows the registration_date for each new runner</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/0*wcCbFOcnr7Zn4GAi.png" /></figure><h4>Table 2: customer_orders</h4><p>Customer pizza orders are captured in the customer_orders table with 1 row for each individual pizza that is part of the order.</p><p>The pizza_id relates to the type of pizza which was ordered whilst the exclusions are the ingredient_id values which should be removed from the pizza and the extras are the ingredient_id values which need to be added to the pizza.</p><p>Note that customers can order multiple pizzas in a single order with varying exclusions and extras values even if the pizza is the same type!</p><p>The exclusions and extras columns will need to be cleaned up before using them in your queries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*P8Wg29uucghHJY48.png" /></figure><h4>Table 3: runner_orders</h4><p>After each orders are received through the system — they are assigned to a runner — however not all orders are fully completed and can be cancelled by the restaurant or the customer.</p><p>The pickup_time is the timestamp at which the runner arrives at the Pizza Runner headquarters to pick up the freshly cooked pizzas. The distance and duration fields are related to how far and long the runner had to travel to deliver the order to the respective customer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/0*FyJuhDncFieL3chG.png" /></figure><h4>Table 4: pizza_names</h4><p>At the moment — Pizza Runner only has 2 pizzas available the Meat Lovers or Vegetarian!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/0*Yuv8tKAZqcE_QaNb.png" /></figure><h4>Table 5: pizza_recipes</h4><p>Each pizza_id has a standard set of toppings which are used as part of the pizza recipe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/0*6X3tldtdhHNcnJQV.png" /></figure><h4>Table 6: pizza_toppings</h4><p>This table contains all of the topping_name values with their corresponding topping_id value</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/0*ttEIbkCeQP-qAYN7.png" /></figure><h3>B. Runner and Customer Experience</h3><p><strong>1. How many runners signed up for each 1 week period? (i.e. week starts </strong><strong>2021-01-01)</strong></p><p>Ans: In this question, we have to find the number of runners who signed up( registered) in each 1 week period. To find out this, we will use CASE WHEN THEN ELSE condition to find the table having runner_id &amp; week_start for the starting date of the week.</p><pre>SELECT runner_id, (<br>CASE <br>WHEN registration_date BETWEEN &#39;2021-01-01&#39; AND &#39;2021-01-07&#39; THEN &#39;2021-01-01&#39; <br>WHEN registration_date BETWEEN &#39;2021-01-08&#39; AND &#39;2021-01-14&#39; THEN &#39;2021-01-08&#39; <br>WHEN registration_date BETWEEN &#39;2021-01-15&#39; AND &#39;2021-01-22&#39; THEN &#39;2021-01-15&#39; <br>WHEN registration_date BETWEEN &#39;2021-01-23&#39; AND &#39;2021-01-30&#39; THEN &#39;2021-01-23&#39; <br>END) AS week_start<br>FROM runners;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/207/1*otSs6iX8yOUAT_V95lBcuw.png" /></figure><p>Now, let’s use CTE as we can’t directly apply COUNT function, then count number of runners in each week using COUNT function using GROUP BY week_start .</p><pre>WITH week_details AS (<br>SELECT runner_id, (<br>CASE <br>WHEN registration_date BETWEEN &#39;2021-01-01&#39; AND &#39;2021-01-07&#39; THEN &#39;2021-01-01&#39; <br>WHEN registration_date BETWEEN &#39;2021-01-08&#39; AND &#39;2021-01-14&#39; THEN &#39;2021-01-08&#39; <br>WHEN registration_date BETWEEN &#39;2021-01-15&#39; AND &#39;2021-01-22&#39; THEN &#39;2021-01-15&#39; <br>WHEN registration_date BETWEEN &#39;2021-01-23&#39; AND &#39;2021-01-30&#39; THEN &#39;2021-01-23&#39; <br>END) AS week_start<br>FROM runners)<br>SELECT week_start,COUNT(*) AS runners_signed_up FROM week_details<br>GROUP BY week_start;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/265/1*fC1X9Ta9E0ZyZvrOc3j_5A.png" /></figure><p>Hence, in 1st week 2 runners signed up, in 2nd week only 1 runner signed up &amp; in 3rd week also only 1 runner signed up.</p><p><strong>2. What was the average time in minutes it took for each runner to arrive at the Pizza Runner HQ to pickup the order?</strong></p><p>Ans: First we have to join runner_orders table with customer_orders table. then calculate the time difference of order_time &amp; pickup_time using TIMESTAMPDIFF function &amp; filter the data using WHERE pickup_time is not equal to ‘null’ (as those orders were cancelled).</p><pre>SELECT runner_id,ro.order_id,TIMESTAMPDIFF(MINUTE,order_time,pickup_time) AS time_in_minute FROM runner_orders ro JOIN customer_orders co<br>ON ro.order_id=co.order_id WHERE pickup_time&lt;&gt;&#39;null&#39;;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/1*Bi91M2fpKDZaSJKsgYsznA.png" /><figcaption>Output for the above query</figcaption></figure><p>As we need to find the average time of each runner but we apply the AVG function directly on time_in_minute , using GROUP BY runner_id .</p><pre>SELECT runner_id,AVG(TIMESTAMPDIFF(MINUTE,order_time,pickup_time)) AS avg_time_minute FROM runner_orders ro JOIN customer_orders co<br>ON ro.order_id=co.order_id WHERE pickup_time&lt;&gt;&#39;null&#39;<br>GROUP BY runner_id;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/214/1*7c1ncKfl6mzufAM1h8f_EA.png" /><figcaption>Output for the above query</figcaption></figure><p>Ans: Hence, the average time it took for runner_1 is 15.33 minutes, runner_2 took 23.40 minutes while runner_3 took 10 minutes to arrive at the Pizza Runner HQ to pick up the order.</p><p><strong>3. Is there any relationship between the number of pizzas and how long the order takes to prepare?</strong></p><p>Ans: First, JOIN customer_orders &amp; runner_orders table and filter the data WHERE pickup_time is not null.</p><pre>SELECT * FROM customer_orders co<br>JOIN runner_orders ro<br>ON co.order_id=ro.order_id<br>WHERE pickup_time&lt;&gt;&#39;null&#39;;</pre><p>Now, let’s count number of pizzas for each order using COUNT (*) on GROUP BY order_id .</p><pre>SELECT co.order_id,COUNT(*) AS num_pizza FROM customer_orders co<br>JOIN runner_orders ro<br>ON co.order_id=ro.order_id<br>WHERE pickup_time&lt;&gt;&#39;null&#39;<br>GROUP BY order_id;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/194/1*cOrjLRgO2iIWxfcP0oGf2w.png" /></figure><p>Now, we will use the raw table of the 2nd query,</p><pre>SELECT DISTINCT co.order_id, TIMESTAMPDIFF(MINUTE,order_time,pickup_time) AS time_in_minute FROM customer_orders co<br>JOIN runner_orders ro<br>ON co.order_id=ro.order_id<br>WHERE pickup_time&lt;&gt;&#39;null&#39;;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*MJuf8GQEC7qCrCEKZrVJoA.png" /></figure><p>Let’s combine both the above tables using JOIN function on pizza.order_id=prep_time.order_time where pizza is the name of the first table while prep_time is the second table. You can follow <a href="https://stackoverflow.com/questions/21672140/join-2-select-statements-on-common-column">this</a> to have deep understanding of combining these two tables.</p><pre>SELECT pizza.order_id,num_pizza,time_in_minute AS preparation_time_min FROM<br>(SELECT co.order_id,COUNT(*) AS num_pizza FROM customer_orders co<br>JOIN runner_orders ro<br>ON co.order_id=ro.order_id<br>WHERE pickup_time&lt;&gt;&#39;null&#39;<br>GROUP BY order_id) AS pizza<br>JOIN<br>(SELECT DISTINCT co.order_id, TIMESTAMPDIFF(MINUTE,order_time,pickup_time) AS time_in_minute FROM customer_orders co<br>JOIN runner_orders ro<br>ON co.order_id=ro.order_id<br>WHERE pickup_time&lt;&gt;&#39;null&#39;) AS prep_time<br>ON pizza.order_id=prep_time.order_id<br>ORDER BY preparation_time_min DESC;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*aKoid6N0wPQ3HNWynnAigw.png" /></figure><p>As, we can see for preparing 3 pizzas the time taken is highest i.e. 29 minutes, while for preparing 2 pizzas for order 3 time taken is 21 minutes while for order 10 it is 15 minutes. And for preparing 1 pizza the time taken is almost 10 minutes except for order 8.</p><p>Hence, we can say more number of pizzas will take higher time to prepare than preparing 1 pizza.</p><p><strong>4. What was the average distance travelled for each customer?</strong></p><p>Ans: First join customer_orders&amp; runner_orderstable. Use the customer_id,order_id,runner_id,distancecolumns.</p><pre>SELECT customer_id, co.order_id, runner_id, distance FROM runner_orders ro JOIN customer_orders co<br>ON ro.order_id=co.order_id;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*gHeD2JrmFbkm5yn_OVfSJw.png" /></figure><p>As there are duplicate rows, first we need to choose distinct tuples/rows by using DISTINCT function on customer_id, as this function won’t work for the in-between columns.</p><pre>SELECT DISTINCT customer_id, co.order_id,runner_id,distance AS distance FROM runner_orders ro JOIN customer_orders co<br>ON ro.order_id=co.order_id WHERE distance&lt;&gt;&#39;null&#39;;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*H0RvgiJvH73AbBZ2frUSBQ.png" /><figcaption>After removing the duplicated rows</figcaption></figure><p>Then, to find out the average distance travelled for each customer, we have to use CTE (distance_travelled) (without using it, we won’t be able to retain the previous table, as then it will work after applying the GROUP BY function), we will use the AVG function by using GROUP BY customer_id, WHERE distance is not equal to ‘null’.</p><pre>WITH distance_travelled AS (<br>SELECT DISTINCT customer_id, co.order_id,runner_id,distance AS distance FROM runner_orders ro JOIN customer_orders co<br>ON ro.order_id=co.order_id WHERE distance&lt;&gt;&#39;null&#39;<br>)<br>SELECT customer_id, AVG(distance) AS average_distance_km FROM distance_travelled<br>GROUP BY customer_id;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/277/1*TsyIcPSon58UUpu3h7yPnA.png" /></figure><p>Hence, average distance travelled for customer 101 is 20 km, for customer 102 is 18.4 km, customer 103 is 23.4 km, customer 104 is 10 km while for customer 105 is 25 km.</p><p><strong>5. What was the difference between the longest and shortest delivery times for all orders?</strong></p><p>Ans: We will use the raw table of 2nd question with some changes, in the time_in_minutecolumn, add duration to get the delivery_time , &amp; choose DISTINCT order_idto remove duplicates.</p><pre>SELECT DISTINCT ro.order_id,TIMESTAMPDIFF(MINUTE,order_time,pickup_time)+duration AS delivery_time FROM runner_orders ro JOIN customer_orders co<br>ON ro.order_id=co.order_id WHERE pickup_time&lt;&gt;&#39;null&#39;;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/207/1*RQBcg74kKF-o9SFuEGiDdg.png" /></figure><p>Now, we will use CTE ( delivery_details) as without this we can’t directly use MAX — MIN, then difference of MAX delivery_time &amp; MIN delivery_time .</p><pre>WITH delivery_details AS(<br>SELECT DISTINCT ro.order_id,TIMESTAMPDIFF(MINUTE,order_time,pickup_time)+duration AS delivery_time FROM runner_orders ro JOIN customer_orders co<br>ON ro.order_id=co.order_id WHERE pickup_time&lt;&gt;&#39;null&#39;<br>)<br>SELECT MAX(delivery_time)-MIN(delivery_time) AS diff_max_min_delivery_time FROM delivery_details;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/1*oSGIn3QqKinKTZQxPxF81A.png" /></figure><p>Hence, the difference between the longest and shortest delivery times for all orders is 44 minutes.</p><p><strong>6. What was the average speed for each runner for each delivery and do you notice any trend for these values?</strong></p><p>Ans: We will use runner_orders table WHERE distance is not null, use (distance/duration)*60to find out the average speed for each runner in km/h.</p><pre>SELECT runner_id,order_id,distance,ROUND((distance/duration)*60,2) AS avg_speed_kmph FROM runner_orders<br>WHERE distance&lt;&gt;&#39;null&#39;<br>ORDER BY runner_id,distance DESC,avg_speed_kmph;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*UeXyZPXcYEsDK-mUS8PKEg.png" /></figure><p>Hence, we can say that the runner’s speed is higher in case of shorter distance than the longer distance for runner 1. While in case of runner 2 this pattern doesn’t follow for all the orders as in case of same distance, there is huge different in his speed.</p><p><strong>7. What is the successful delivery percentage for each runner?</strong></p><p>Ans: First, let’s create the table for calculating total number of orders for each runner using COUNT function, GROUP BY runner_id .</p><pre>SELECT runner_id, COUNT(*) AS total_orders FROM runner_orders<br>GROUP BY runner_id;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/211/1*tu0t6jWYyVXM2rMyxn2LFg.png" /></figure><p>Now, Let’s create the table for calculating delivered number of orders for each runner using COUNT function WHERE distancenot equal to null then GROUP BY runner_id .</p><pre>SELECT runner_id, COUNT(*) AS delivered_orders FROM runner_orders<br>WHERE distance&lt;&gt;&#39;null&#39;<br>GROUP BY runner_id;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/1*X1aNDt-3qBd-WBxjN4MbfQ.png" /></figure><p>Let’s combine both the above tables using JOIN, then use delivered_orders*100/total_ordersto find the successful_delivery_percentage&amp; use ROUND function to round the value.</p><pre>SELECT o.runner_id,ROUND(delivered_orders*100/total_orders,0) AS successful_delivery_percentage FROM (<br>SELECT runner_id, COUNT(*) AS total_orders FROM runner_orders<br>GROUP BY runner_id) AS o<br>JOIN <br>( SELECT runner_id, COUNT(*) AS delivered_orders FROM runner_orders<br>WHERE distance&lt;&gt;&#39;null&#39;<br>GROUP BY runner_id) AS od<br>ON o.runner_id=od.runner_id;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*EWrHhpIKYWlbpqlfjgQ7tA.png" /></figure><p>Hence, the successful delivery percentage for runner 1 is 100%, runner 2 is 75% while runner 3 is 50%.</p><h3>Insights:</h3><ul><li>In 1st week 2 runners signed up, in 2nd week only 1 runner signed up &amp; in 3rd week also only 1 runner signed up.</li><li>The average time it took for runner_1 is 15.33 minutes, runner_2 took 23.40 minutes while runner_3 took 10 minutes to arrive at the Pizza Runner HQ to pick up the order.</li><li>We can say more number of pizzas will take higher time to prepare than preparing 1 pizza.</li><li>Average distance travelled for customer 101 is 20 km, for customer 102 is 18.4 km, customer 103 is 23.4 km, customer 104 is 10 km while for customer 105 is 25 km.</li><li>The difference between the longest and shortest delivery times for all orders is 44 minutes.</li><li>Runner’s speed is higher in case of shorter distance than the longer distance for runner 1. While in case of runner 2 this pattern doesn’t follow for all the orders as in case of same distance, there is huge different in his speed.</li><li>The successful delivery percentage for runner 1 is 100%, runner 2 is 75% while runner 3 is 50%.</li></ul><h3>Future Work Ideas:</h3><ul><li>Ingredient Optimisation</li><li>Pricing and Ratings</li><li>Bonus DML Challenges (DML = Data Manipulation Language)</li></ul><h3>References:</h3><ul><li><a href="https://8weeksqlchallenge.com/case-study-2/">https://8weeksqlchallenge.com/case-study-2/</a></li><li><a href="https://medium.com/jovianml/8-week-sql-challenge-case-study-2-pizza-runner-5899386d9">https://medium.com/jovianml/8-week-sql-challenge-case-study-2-pizza-runner-5899386d9</a></li><li><a href="https://stackoverflow.com/questions/1629201/sql-replace-old-values-with-new-ones">https://stackoverflow.com/questions/1629201/sql-replace-old-values-with-new-ones</a></li><li><a href="https://stackoverflow.com/questions/11448068/mysql-error-code-1175-during-update-in-mysql-workbench">https://stackoverflow.com/questions/11448068/mysql-error-code-1175-during-update-in-mysql-workbench</a></li><li><a href="https://learnsql.com/blog/what-is-common-table-expression/">https://learnsql.com/blog/what-is-common-table-expression/</a></li><li><a href="https://www.w3schools.com/sql/func_mysql_weekday.asp">https://www.w3schools.com/sql/func_mysql_weekday.asp</a></li><li><a href="https://stackoverflow.com/questions/17407481/check-if-a-time-is-between-two-times-time-datatype">https://stackoverflow.com/questions/17407481/check-if-a-time-is-between-two-times-time-datatype</a></li></ul><p>I hope you enjoyed reading the article. Do follow for the continuation of this case study.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9034689f92b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[8 Week SQL Challenge — Case Study #2 — Pizza Runner]]></title>
            <link>https://medium.com/@kshamasinghal/8-week-sql-challenge-case-study-2-pizza-runner-5899386d9519?source=rss-4a27dccb1e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5899386d9519</guid>
            <category><![CDATA[sql-window-functions]]></category>
            <category><![CDATA[common-table-expressions]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[mysql]]></category>
            <dc:creator><![CDATA[Kshama Singhal]]></dc:creator>
            <pubDate>Thu, 20 Apr 2023 04:59:56 GMT</pubDate>
            <atom:updated>2023-05-06T06:30:40.178Z</atom:updated>
            <content:encoded><![CDATA[<h3>8 Week SQL Challenge — Case Study #2 — Pizza Runner</h3><p>We will use MYSQL Workbench for solving this case study. You can see this case study here: <a href="https://8weeksqlchallenge.com/case-study-2/">https://8weeksqlchallenge.com/case-study-2/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CWo5FkxqhYdRczyl.png" /></figure><h3>Introduction</h3><p>Did you know that over <strong>115 million kilograms</strong> of pizza is consumed daily worldwide??? (Well according to Wikipedia anyway…)</p><p>Danny was scrolling through his Instagram feed when something really caught his eye — “80s Retro Styling and Pizza Is The Future!”</p><p>Danny was sold on the idea, but he knew that pizza alone was not going to help him get seed funding to expand his new Pizza Empire — so he had one more genius idea to combine with it — he was going to <em>Uberize</em> it — and so Pizza Runner was launched!</p><p>Danny started by recruiting “runners” to deliver fresh pizza from Pizza Runner Headquarters (otherwise known as Danny’s house) and also maxed out his credit card to pay freelance developers to build a mobile app to accept orders from customers.</p><h3>Available Data</h3><p>Because Danny had a few years of experience as a data scientist — he was very aware that data collection was going to be critical for his business’ growth.</p><p>He has prepared for us an entity relationship diagram of his database design but requires further assistance to clean his data and apply some basic calculations so he can better direct his runners and optimise Pizza Runner’s operations.</p><p>All datasets exist within the pizza_runner database schema - be sure to include this reference within your SQL scripts as you start exploring the data and answering the case study questions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*361_3Pg-CbI_EOEeJd1Clw.png" /></figure><p><strong>Table 1: runners</strong></p><p>The runners table shows the registration_date for each new runner</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*1-D9An-zrPATO3Rqnda3WA.png" /></figure><p><strong>Table 2: customer_orders</strong></p><p>Customer pizza orders are captured in the customer_orders table with 1 row for each individual pizza that is part of the order.</p><p>The pizza_id relates to the type of pizza which was ordered whilst the exclusions are the ingredient_id values which should be removed from the pizza and the extras are the ingredient_id values which need to be added to the pizza.</p><p>Note that customers can order multiple pizzas in a single order with varying exclusions and extras values even if the pizza is the same type!</p><p>The exclusions and extras columns will need to be cleaned up before using them in your queries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*TNZDFB91slWVYrDRWATbUw.png" /></figure><p><strong>Table 3: runner_orders</strong></p><p>After each orders are received through the system — they are assigned to a runner — however not all orders are fully completed and can be cancelled by the restaurant or the customer.</p><p>The pickup_time is the timestamp at which the runner arrives at the Pizza Runner headquarters to pick up the freshly cooked pizzas. The distance and duration fields are related to how far and long the runner had to travel to deliver the order to the respective customer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*FQGzb2ZtQDRQzvz-9sseyQ.png" /></figure><p><strong>Table 4: pizza_names</strong></p><p>At the moment — Pizza Runner only has 2 pizzas available the Meat Lovers or Vegetarian!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*Lcz0ovd_UXoI6THe0u35cQ.png" /></figure><p><strong>Table 5: pizza_recipes</strong></p><p>Each pizza_id has a standard set of toppings which are used as part of the pizza recipe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*x7xp8mNc4JFRvjRO6pr_Xg.png" /></figure><p><strong>Table 6:</strong> <strong>pizza_toppings</strong></p><p>This table contains all of the topping_name values with their corresponding topping_id value</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*4CfhFdodZYZrHRNXMr6YRQ.png" /></figure><h4>First let’s create the database and tables.</h4><p>We will use CREATE DATABASE, CREATE TABLE, INSERT INTO functions for the purpose. You can check out this: <a href="https://www.w3schools.com/mysql/mysql_sql.asp">Link</a></p><pre>CREATE DATABASE pizza_runner;<br><br>USE pizza_runner;<br><br>CREATE TABLE runners(<br>runner_id int,<br>registration_date date<br>);<br>INSERT INTO runners VALUES (1,&#39;2021-01-01&#39;),(2,&#39;2021-01-03&#39;),<br>(3,&#39;2021-01-08&#39;),(4,&#39;2021-01-15&#39;);<br><br>CREATE TABLE customer_orders(<br>order_id int,<br>customer_id int,<br>pizza_id int,<br>exclusions varchar(4),<br>extras varchar(4),<br>order_date timestamp<br>);<br>INSERT INTO customer_orders VALUES <br>(1,101,1,NULL,NULL,&#39;2021-01-01 18:05:02&#39;),<br>(2,101,1,NULL,NULL,&#39;2021-01-01 19:00:52&#39;),<br>(3,102,1,NULL,NULL,&#39;2021-01-02 23:51:23&#39;),<br>(3,102,2,NULL,&#39;NaN&#39;,&#39;2021-01-02 23:51:23&#39;),<br>(4,103,1,&#39;4&#39;,NULL,&#39;2021-01-04 13:23:46&#39;),<br>(4,103,1,&#39;4&#39;,NULL,&#39;2021-01-04 13:23:46&#39;),<br>(4,103,2,&#39;4&#39;,NULL,&#39;2021-01-04 13:23:46&#39;),<br>(5,104,1,NULL,&#39;1&#39;,&#39;2021-01-08 21:00:29&#39;),<br>(6,101,2,NULL,NULL,&#39;2021-01-08 21:03:13&#39;),<br>(7,105,2,NULL,&#39;1&#39;,&#39;2021-01-08 21:20:29&#39;),<br>(8,102,1,NULL,NULL,&#39;2021-01-09 23:54:33&#39;),<br>(9,103,1,&#39;4&#39;,&#39;1,5&#39;,&#39;2021-01-10 11:22:59&#39;),<br>(10,104,1,NULL,NULL,&#39;2021-01-11 18:34:49&#39;),<br>(10,104,1,&#39;2,6&#39;,&#39;1,4&#39;,&#39;2021-01-11 18:34:49&#39;)<br>;<br><br>CREATE TABLE runner_orders(<br>order_id int,<br>runner_id int,<br>pickup_time varchar(19),<br>distance varchar(7),<br>duration varchar(10),<br>cancellation varchar(33)<br>);<br>INSERT INTO runner_orders<br>VALUES<br>  (&#39;1&#39;, &#39;1&#39;, &#39;2020-01-01 18:15:34&#39;, &#39;20km&#39;, &#39;32 minutes&#39;, &#39;&#39;),<br>  (&#39;2&#39;, &#39;1&#39;, &#39;2020-01-01 19:10:54&#39;, &#39;20km&#39;, &#39;27 minutes&#39;, &#39;&#39;),<br>  (&#39;3&#39;, &#39;1&#39;, &#39;2020-01-03 00:12:37&#39;, &#39;13.4km&#39;, &#39;20 mins&#39;, NULL),<br>  (&#39;4&#39;, &#39;2&#39;, &#39;2020-01-04 13:53:03&#39;, &#39;23.4&#39;, &#39;40&#39;, NULL),<br>  (&#39;5&#39;, &#39;3&#39;, &#39;2020-01-08 21:10:57&#39;, &#39;10&#39;, &#39;15&#39;, NULL),<br>  (&#39;6&#39;, &#39;3&#39;, &#39;null&#39;, &#39;null&#39;, &#39;null&#39;, &#39;Restaurant Cancellation&#39;),<br>  (&#39;7&#39;, &#39;2&#39;, &#39;2020-01-08 21:30:45&#39;, &#39;25km&#39;, &#39;25mins&#39;, &#39;null&#39;),<br>  (&#39;8&#39;, &#39;2&#39;, &#39;2020-01-10 00:15:02&#39;, &#39;23.4 km&#39;, &#39;15 minute&#39;, &#39;null&#39;),<br>  (&#39;9&#39;, &#39;2&#39;, &#39;null&#39;, &#39;null&#39;, &#39;null&#39;, &#39;Customer Cancellation&#39;),<br>  (&#39;10&#39;, &#39;1&#39;, &#39;2020-01-11 18:50:20&#39;, &#39;10km&#39;, &#39;10minutes&#39;, &#39;null&#39;);<br><br>CREATE TABLE pizza_names(<br>pizza_id int,<br>pizza_name text<br>);<br>INSERT INTO pizza_names<br>VALUES<br>  (1, &#39;Meatlovers&#39;),<br>  (2, &#39;Vegetarian&#39;);<br><br>CREATE TABLE pizza_recipes(<br>pizza_id int,<br>toppings text<br>);<br>INSERT INTO pizza_recipes<br>VALUES<br>  (1, &#39;1, 2, 3, 4, 5, 6, 8, 10&#39;),<br>  (2, &#39;4, 6, 7, 9, 11, 12&#39;);<br><br>CREATE TABLE pizza_toppings(<br>topping_id int,<br>topping_name text<br>);<br>INSERT INTO pizza_toppings VALUES<br>  (1, &#39;Bacon&#39;),<br>  (2, &#39;BBQ Sauce&#39;),<br>  (3, &#39;Beef&#39;),<br>  (4, &#39;Cheese&#39;),<br>  (5, &#39;Chicken&#39;),<br>  (6, &#39;Mushrooms&#39;),<br>  (7, &#39;Onions&#39;),<br>  (8, &#39;Pepperoni&#39;),<br>  (9, &#39;Peppers&#39;),<br>  (10, &#39;Salami&#39;),<br>  (11, &#39;Tomatoes&#39;),<br>  (12, &#39;Tomato Sauce&#39;);</pre><h3>Case Study Questions</h3><p>This case study has <strong>LOTS</strong> of questions — they are broken up by area of focus including:</p><ul><li>Pizza Metrics</li><li>Runner and Customer Experience</li><li>Ingredient Optimization</li><li>Pricing and Ratings</li><li>Bonus DML Challenges (DML = Data Manipulation Language)</li></ul><p>Before you start writing your SQL queries however — you might want to investigate the data, you may want to do something with some of those null values and data types in the customer_orders and runner_orders tables!</p><p>In this post we will focus on Pizza Metrices, then in the coming posts we will focus on the remaining.</p><h3>A. Pizza Metrics</h3><ol><li><strong>How many pizzas were ordered?</strong></li></ol><p>Ans: For finding the number of pizzas, customer_orders table will be needed. Let’s have a look on the customer_orders table.</p><pre>SELECT * FROM customer_orders;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*KP5y5epLTKWRuRODJhAfeg.png" /></figure><p>To find out the number of pizzas we have to count the number of rows for order_id using COUNT function. I have used <a href="https://www.w3schools.com/mysql/mysql_alias.asp">alias</a> ‘AS’ to give the column a more readable name i.e. num_pizzas.</p><pre>SELECT COUNT(order_id) AS num_pizzas FROM customer_orders;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/100/1*JP1tmlykLJtYIziiVmQv3w.png" /></figure><p>Hence, 14 pizzas were ordered.</p><p><strong>2. How many unique customer orders were made?</strong></p><p>Ans: For finding the unique customer orders we have to find unique orders, we have to use DISTINCT function with COUNT function for the order_id.</p><pre>SELECT COUNT(DISTINCT order_id) AS uni_customer_orders FROM customer_orders;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/185/1*L7Z2DclLiZRi8UIsdX137w.png" /></figure><p>Hence, 10 unique customer orders were made.</p><p><strong>3. How many successful orders were delivered by each runner?</strong></p><p>Ans: First, we have to filter the data whose orders are not cancelled from the runner_orders table.</p><pre>SELECT * FROM runner_orders   WHERE cancellation=&#39;&#39; OR cancellation=&quot;null&quot; OR cancellation IS NULL;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*lMvGrm1Z871_AscYWGSntQ.png" /><figcaption>output for the above code</figcaption></figure><p>Now, we have to count number of orders delivered for every runner, we can find it using GROUP BY runner_id &amp; COUNT function on order_id.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/1*WVo0skgg92lRhreIkGuc2w.png" /></figure><p>Hence, runners with id 1,2,3 delivered 4, 3 and 1 orders respectively.</p><p><strong>4. How many of each type of pizza was delivered?</strong></p><p>Ans: We will use the raw table of the previous query,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*lMvGrm1Z871_AscYWGSntQ.png" /><figcaption>raw table of the previous query</figcaption></figure><p>Now, we have to join this table with the customer_orders table to get the pizza_id and will join with the pizza_names table to get the pizza names.</p><pre>SELECT ro.runner_id,ro.order_id,co.pizza_id,pizza_name <br>FROM runner_orders  ro JOIN customer_orders co ON ro.order_id=co.order_id<br>JOIN pizza_names pn ON co.pizza_id=pn.pizza_id<br>WHERE cancellation=&#39;&#39; OR cancellation=&quot;null&quot; OR cancellation IS NULL;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*yFOcC7oqsgorzZmtUHO4WQ.png" /><figcaption>output for the above query</figcaption></figure><p>Let’s count each type of pizza delivered using GROUP BY pizza_name &amp; COUNT order_id .</p><pre>SELECT pizza_name, COUNT(co.order_id) as delivered_pizza <br>FROM runner_orders  ro JOIN customer_orders co ON ro.order_id=co.order_id<br>JOIN pizza_names pn ON co.pizza_id=pn.pizza_id<br>WHERE cancellation=&#39;&#39; OR cancellation=&quot;null&quot; OR cancellation IS NULL<br>GROUP BY pizza_name;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*syfH9jMD7lApNb9ATQCPMA.png" /></figure><p>Hence, 9 Meatlovers pizzas were delivered while 3 vegetarian pizzas were delivered.</p><p><strong>5. How many Vegetarian and Meatlovers were ordered by each customer?</strong></p><p>Ans: First, we will join customer_orders table with pizza_names.</p><pre>SELECT customer_id, co.order_id, pizza_name <br>FROM customer_orders co <br>JOIN pizza_names pn ON co.pizza_id=pn.pizza_id;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*Iboi0KV_2j1Ec8sC-QHg1w.png" /><figcaption>Output (part) for the above query</figcaption></figure><p>We will use GROUP BY customer_id,pizza_name&amp; COUNT order_id to calculate the result, we are grouping by customers first then grouping by pizza_names because first divide it according to customers then customers according to the pizza_names.</p><pre>SELECT customer_id, pizza_name, COUNT(co.order_id) AS pizza_ordered<br>FROM customer_orders co <br>JOIN pizza_names pn ON co.pizza_id=pn.pizza_id<br>GROUP BY customer_id,pizza_name<br>ORDER BY customer_id;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/1*B88eyL2HlrJTmymR206uVw.png" /></figure><p>Hence, customer with id 101 ordered 2 Meatlovers &amp; 1 Vegetarian pizza, 102 ordered 2 Meatlovers &amp; 1 Vegetarian pizza, 103 ordered 3 Meatlovers &amp; 1 Vegetarian pizza, 104 ordered 3 Meatlovers pizza while 105 ordered only 1 Vegetarian pizza.</p><p><strong>6. What was the maximum number of pizzas delivered in a single order?</strong></p><p>Ans: We will use the raw table used in the 3rd question for this query,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*lMvGrm1Z871_AscYWGSntQ.png" /><figcaption>Raw table of 3rd question</figcaption></figure><p>We will join this table with customer_orders, then use GROUP BY order_id &amp; COUNT * to calculate number of pizza delivered for each order_id, then ORDER BY number of delivered pizzas.</p><pre>SELECT co.order_id, COUNT(*) AS num_delivered<br>FROM runner_orders  ro JOIN customer_orders co ON ro.order_id=co.order_id<br>WHERE cancellation=&#39;&#39; OR cancellation=&quot;null&quot; OR cancellation IS NULL<br>GROUP BY order_id<br>ORDER BY num_delivered DESC LIMIT 1;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/161/1*Hx7Wnv1lEOsLuhC55c9Xew.png" /></figure><p>Hence, there were maximum 3 pizzas were delivered in a single order.</p><p><strong>7. For each customer, how many delivered pizzas had at least 1 change and how many had no changes?</strong></p><p>Ans: We will use the previous questions’ raw table with all columns, i.e.</p><pre>SELECT * FROM runner_orders  ro JOIN customer_orders co ON ro.order_id=co.order_id<br>WHERE cancellation=&#39;&#39; OR cancellation=&quot;null&quot; OR cancellation IS NULL;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A1gBntScjkF5iCZtmcEarQ.png" /></figure><p>First, let’s clean this table by filling the missing values &amp; null values with NULL . For cleaning, please check these links: <a href="https://stackoverflow.com/questions/11448068/mysql-error-code-1175-during-update-in-mysql-workbench">Link_1</a> <a href="https://stackoverflow.com/questions/1629201/sql-replace-old-values-with-new-ones">Link_2</a></p><pre>SET SQL_SAFE_UPDATES = 0;<br><br>UPDATE customer_orders SET exclusions=Null WHERE exclusions=&#39;null&#39;;<br>UPDATE customer_orders SET extras=Null WHERE extras=&#39;null&#39;;<br>UPDATE customer_orders SET exclusions=Null WHERE exclusions=&#39;&#39;;<br>UPDATE customer_orders SET extras=Null WHERE extras=&#39;&#39;;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e_dWyG8zYNMPyOYu-df5UQ.png" /><figcaption>Table after cleaning the data</figcaption></figure><p>Now, we will use SUM function on IF function by using the GROUP BY function customer_id,by using the logic if exclusions is NULL &amp; extras is NULL, then there is no change while if one of them is not NULL, then there is at least one change.</p><pre>SELECT customer_id,SUM(IF((exclusions IS NULL) AND (extras IS NULL),1,0)) AS `No_Change`,<br>SUM(IF((exclusions IS NOT NULL) OR (extras IS NOT NULL),1,0)) AS `Changed`<br>FROM runner_orders  ro JOIN customer_orders co ON ro.order_id=co.order_id<br>WHERE cancellation=&#39;&#39; OR cancellation=&quot;null&quot; OR cancellation IS NULL<br>GROUP BY customer_id;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*RZRCYDl1nLHfCqr1iXMnbw.png" /></figure><p>Hence, for 101, 2 pizzas were delivered with no change. For 102, 3 pizzas were delivered with no change. For 103, 3 changed pizzas were delivered. For 104, 1 pizza was delivered with no change &amp; 2 pizzas were delivered with at least one change. For 105, 1 pizza was delivered with at least one change.</p><p><strong>8. How many pizzas were delivered that had both exclusions and extras?</strong></p><p>Ans: We will use the raw table of the previous query with some changes such as adding a new column excl_extrathat will check if both the exclusions &amp; extras are NOT NULL. After using the SUM function it will add up and give number of delivered pizzas with both exclusions &amp; extras.</p><pre>SELECT Sum(IF((exclusions IS NOT NULL) AND (extras IS NOT NULL),1,0)) AS `excl_extras`<br>FROM runner_orders  ro JOIN customer_orders co ON ro.order_id=co.order_id<br>WHERE cancellation=&#39;&#39; OR cancellation=&quot;null&quot; OR cancellation IS NULL;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/117/1*VQX2t904PBjuOnidydQm6g.png" /></figure><p>Hence, only one pizzas was delivered with both exclusions &amp; extras.</p><p><strong>9. What was the total volume of pizzas ordered for each hour of the day?</strong></p><p>Ans: First we will extract out time from the customer_orders table using CAST function.</p><pre>SELECT pizza_id,CAST(order_time AS time) AS ordered_time FROM customer_orders;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/202/1*gaIUfja2ca8NpdHc7o05_w.png" /><figcaption>Output for the above query</figcaption></figure><p>Then, create a table for mentioning the ordered_hour counted in such a way that if the ordered_time is between 00:00:00 to 01:00:00 then order_hour will be considered as 1. To create this table, we will use <a href="https://learnsql.com/blog/what-is-common-table-expression/">CTE</a> as we can’t use ordered_time without this, then use CASE WHEN THEN ELSE conditions to create the order_hour column. You can check out <a href="https://stackoverflow.com/questions/17407481/check-if-a-time-is-between-two-times-time-datatype">this</a> for checking the time between two times.</p><pre>WITH order_details AS(<br>SELECT pizza_id,CAST(order_time AS time) AS ordered_time FROM customer_orders)<br>SELECT *,<br>(CASE  <br>WHEN ordered_time BETWEEN &#39;00:00:00&#39; AND &#39;01:00:00&#39; THEN 1 <br>WHEN ordered_time BETWEEN &#39;01:00:00&#39; AND &#39;02:00:00&#39; THEN 2 <br>WHEN ordered_time BETWEEN &#39;02:00:00&#39; AND &#39;03:00:00&#39; THEN 3 <br>WHEN ordered_time BETWEEN &#39;03:00:00&#39; AND &#39;04:00:00&#39; THEN 4 <br>WHEN ordered_time BETWEEN &#39;04:00:00&#39; AND &#39;05:00:00&#39; THEN 5 <br>WHEN ordered_time BETWEEN &#39;05:00:00&#39; AND &#39;06:00:00&#39; THEN 6 <br>WHEN ordered_time BETWEEN &#39;06:00:00&#39; AND &#39;07:00:00&#39; THEN 7 <br>WHEN ordered_time BETWEEN &#39;07:00:00&#39; AND &#39;08:00:00&#39; THEN 8 <br>WHEN ordered_time BETWEEN &#39;08:00:00&#39; AND &#39;09:00:00&#39; THEN 9 <br>WHEN ordered_time BETWEEN &#39;09:00:00&#39; AND &#39;10:00:00&#39; THEN 10 <br>WHEN ordered_time BETWEEN &#39;10:00:00&#39; AND &#39;11:00:00&#39; THEN 11 <br>WHEN ordered_time BETWEEN &#39;11:00:00&#39; AND &#39;12:00:00&#39; THEN 12 <br>WHEN ordered_time BETWEEN &#39;12:00:00&#39; AND &#39;13:00:00&#39; THEN 13 <br>WHEN ordered_time BETWEEN &#39;13:00:00&#39; AND &#39;14:00:00&#39; THEN 14 <br>WHEN ordered_time BETWEEN &#39;14:00:00&#39; AND &#39;15:00:00&#39; THEN 15 <br>WHEN ordered_time BETWEEN &#39;15:00:00&#39; AND &#39;16:00:00&#39; THEN 16 <br>WHEN ordered_time BETWEEN &#39;16:00:00&#39; AND &#39;17:00:00&#39; THEN 17 <br>WHEN ordered_time BETWEEN &#39;17:00:00&#39; AND &#39;18:00:00&#39; THEN 18 <br>WHEN ordered_time BETWEEN &#39;18:00:00&#39; AND &#39;19:00:00&#39; THEN 19 <br>WHEN ordered_time BETWEEN &#39;19:00:00&#39; AND &#39;20:00:00&#39; THEN 20 <br>WHEN ordered_time BETWEEN &#39;20:00:00&#39; AND &#39;21:00:00&#39; THEN 21 <br>WHEN ordered_time BETWEEN &#39;21:00:00&#39; AND &#39;22:00:00&#39; THEN 22<br>WHEN ordered_time BETWEEN &#39;22:00:00&#39; AND &#39;23:00:00&#39; THEN 23<br>WHEN ordered_time BETWEEN &#39;23:00:00&#39; AND &#39;24:00:00&#39; THEN 24<br>END) order_hour<br>FROM order_details;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*q-5id9e_bf3EXo6YPjeOAQ.png" /><figcaption>Output for the above query</figcaption></figure><p>Now, finally create one more CTE ordered_hour_details to make the code readable, then count number of orders for each hour using COUNT pizza_id by GROUP BY order_hour</p><pre>WITH order_details AS(<br>SELECT pizza_id,CAST(order_time AS time) AS ordered_time FROM customer_orders),<br>ordered_hour_details AS(<br>SELECT *,<br>(CASE  <br>WHEN ordered_time BETWEEN &#39;00:00:00&#39; AND &#39;01:00:00&#39; THEN 1 <br>WHEN ordered_time BETWEEN &#39;01:00:00&#39; AND &#39;02:00:00&#39; THEN 2 <br>WHEN ordered_time BETWEEN &#39;02:00:00&#39; AND &#39;03:00:00&#39; THEN 3 <br>WHEN ordered_time BETWEEN &#39;03:00:00&#39; AND &#39;04:00:00&#39; THEN 4 <br>WHEN ordered_time BETWEEN &#39;04:00:00&#39; AND &#39;05:00:00&#39; THEN 5 <br>WHEN ordered_time BETWEEN &#39;05:00:00&#39; AND &#39;06:00:00&#39; THEN 6 <br>WHEN ordered_time BETWEEN &#39;06:00:00&#39; AND &#39;07:00:00&#39; THEN 7 <br>WHEN ordered_time BETWEEN &#39;07:00:00&#39; AND &#39;08:00:00&#39; THEN 8 <br>WHEN ordered_time BETWEEN &#39;08:00:00&#39; AND &#39;09:00:00&#39; THEN 9 <br>WHEN ordered_time BETWEEN &#39;09:00:00&#39; AND &#39;10:00:00&#39; THEN 10 <br>WHEN ordered_time BETWEEN &#39;10:00:00&#39; AND &#39;11:00:00&#39; THEN 11 <br>WHEN ordered_time BETWEEN &#39;11:00:00&#39; AND &#39;12:00:00&#39; THEN 12 <br>WHEN ordered_time BETWEEN &#39;12:00:00&#39; AND &#39;13:00:00&#39; THEN 13 <br>WHEN ordered_time BETWEEN &#39;13:00:00&#39; AND &#39;14:00:00&#39; THEN 14 <br>WHEN ordered_time BETWEEN &#39;14:00:00&#39; AND &#39;15:00:00&#39; THEN 15 <br>WHEN ordered_time BETWEEN &#39;15:00:00&#39; AND &#39;16:00:00&#39; THEN 16 <br>WHEN ordered_time BETWEEN &#39;16:00:00&#39; AND &#39;17:00:00&#39; THEN 17 <br>WHEN ordered_time BETWEEN &#39;17:00:00&#39; AND &#39;18:00:00&#39; THEN 18 <br>WHEN ordered_time BETWEEN &#39;18:00:00&#39; AND &#39;19:00:00&#39; THEN 19 <br>WHEN ordered_time BETWEEN &#39;19:00:00&#39; AND &#39;20:00:00&#39; THEN 20 <br>WHEN ordered_time BETWEEN &#39;20:00:00&#39; AND &#39;21:00:00&#39; THEN 21 <br>WHEN ordered_time BETWEEN &#39;21:00:00&#39; AND &#39;22:00:00&#39; THEN 22<br>WHEN ordered_time BETWEEN &#39;22:00:00&#39; AND &#39;23:00:00&#39; THEN 23<br>WHEN ordered_time BETWEEN &#39;23:00:00&#39; AND &#39;24:00:00&#39; THEN 24<br>END) order_hour<br>FROM order_details)<br>SELECT order_hour, COUNT(pizza_id) AS num_pizza FROM ordered_hour_details<br>GROUP BY order_hour ORDER BY order_hour;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/208/1*5Kl_untmnaKze5-QrFpFLA.png" /></figure><p>Hence, 12th hour has 1 order, 14th hour has 3 orders, 19th hour has 3 orders, 20th hour has 1 order, 22rd hour has 3 order &amp; 24th hour has 3 orders while other hours doesn’t have any orders.</p><p><strong>10. What was the volume of orders for each day of the week?</strong></p><p>Ans: Follow the same process as used in the previous query, by changing a little bit, will use WEEKDAY function to find out the number of the weekday then convert into weekday names using CASE WHEN THEN ELSE condition. Then COUNT pizza_id by applying GROUP BY order_day</p><pre>WITH order_details AS(<br>SELECT pizza_id, WEEKDAY(order_time) AS ordered_day FROM customer_orders),<br>ordered_weekday_details AS(<br>SELECT *,<br>(CASE  <br>WHEN ordered_day=0 THEN &#39;Sunday&#39; <br>WHEN ordered_day=1 THEN &#39;Monday&#39; <br>WHEN ordered_day=2 THEN &#39;Tuesday&#39; <br>WHEN ordered_day=3 THEN &#39;Wednesday&#39; <br>WHEN ordered_day=4 THEN &#39;Thursday&#39; <br>WHEN ordered_day=5 THEN &#39;Friday&#39; <br>WHEN ordered_day=6 THEN &#39;Saturday&#39; <br>END) order_day<br>FROM order_details)<br>SELECT order_day, COUNT(pizza_id) AS num_pizza FROM ordered_weekday_details<br>GROUP BY order_day ORDER BY ordered_day;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/211/1*OZzGuLDRYlC2KD1CAXvBZw.png" /></figure><p>Hence, Volume of orders was 5 for Tuesday, 3 for Wednesday, 1 for Thursday, 5 for Friday while other days of the week doesn’t have any orders.</p><h4><strong>Insights:</strong></h4><ul><li>14 pizzas were ordered.</li><li>10 unique customer orders were made.</li><li>Runners with id 1,2,3 delivered 4, 3 and 1 orders respectively.</li><li>9 Meatlovers pizzas were delivered while 3 vegetarian pizzas were delivered.</li><li>Customer with id 101 ordered 2 Meatlovers &amp; 1 Vegetarian pizza, 102 ordered 2 Meatlovers &amp; 1 Vegetarian pizza, 103 ordered 3 Meatlovers &amp; 1 Vegetarian pizza, 104 ordered 3 Meatlovers pizza while 105 ordered only 1 Vegetarian pizza.</li><li>Maximum 3 pizzas were delivered in a single order.</li><li>For customer with id 101, 2 pizzas were delivered with no change. For 102, 3 pizzas were delivered with no change. For 103, 3 changed pizzas were delivered. For 104, 1 pizza was delivered with no change &amp; 2 pizzas were delivered with at least one change. For 105, 1 pizza was delivered with at least one change.</li><li>Only one pizzas was delivered with both exclusions &amp; extras.</li><li>12th hour has 1 order, 14th hour has 3 orders, 19th hour has 3 orders, 20th hour has 1 order, 22rd hour has 3 order &amp; 24th hour has 3 orders while other hours of the day doesn’t have any orders.</li><li>Volume of orders was 5 for Tuesday, 3 for Wednesday, 1 for Thursday, 5 for Friday while other days of the week doesn’t have any orders.</li></ul><h4>Future Work Ideas:</h4><ul><li>Runner and Customer Experience</li><li>Ingredient Optimisation</li><li>Pricing and Ratings</li><li>Bonus DML Challenges (DML = Data Manipulation Language)</li></ul><h4><strong>References:</strong></h4><ul><li><a href="https://8weeksqlchallenge.com/case-study-2/">https://8weeksqlchallenge.com/case-study-2/</a></li><li><a href="https://stackoverflow.com/questions/1629201/sql-replace-old-values-with-new-ones">https://stackoverflow.com/questions/1629201/sql-replace-old-values-with-new-ones</a></li><li><a href="https://stackoverflow.com/questions/11448068/mysql-error-code-1175-during-update-in-mysql-workbench">https://stackoverflow.com/questions/11448068/mysql-error-code-1175-during-update-in-mysql-workbench</a></li><li><a href="https://learnsql.com/blog/what-is-common-table-expression/">https://learnsql.com/blog/what-is-common-table-expression/</a></li><li><a href="https://www.w3schools.com/sql/func_mysql_weekday.asp">https://www.w3schools.com/sql/func_mysql_weekday.asp</a></li><li><a href="https://stackoverflow.com/questions/17407481/check-if-a-time-is-between-two-times-time-datatype">https://stackoverflow.com/questions/17407481/check-if-a-time-is-between-two-times-time-datatype</a></li></ul><p>I hope you enjoyed reading the article. Do follow for the continuation of this case study.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5899386d9519" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Store Sales- Time Series Forecasting Using Machine Learning]]></title>
            <link>https://medium.com/@kshamasinghal/store-sales-time-series-forecasting-using-machine-learning-90ecc58c43e4?source=rss-4a27dccb1e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/90ecc58c43e4</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[random-forest-regressor]]></category>
            <category><![CDATA[sales-prediction]]></category>
            <category><![CDATA[decision-tree-regressor]]></category>
            <dc:creator><![CDATA[Kshama Singhal]]></dc:creator>
            <pubDate>Tue, 13 Dec 2022 06:43:42 GMT</pubDate>
            <atom:updated>2022-12-13T10:33:25.133Z</atom:updated>
            <content:encoded><![CDATA[<h4>Data Science</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ydBQVH87d4R4k8N4HnVfeQ.jpeg" /></figure><p>Machine Learning allows the computer to learn from experience and understand the world in terms of hierarchy. The field of this is interested in finding the regularities in the data through the use of computer algorithms and with the help of these regularities perform tasks like classifying the data into different classes or predicting the output on the basis of input data.</p><h3>Problem Statement (<a href="https://www.kaggle.com/competitions/store-sales-time-series-forecasting/data">Dataset</a>)</h3><p><em>I have to use time-series forecasting to forecast store sales on data from Corporación Favorita, a large Ecuadorian-based grocery retailer. Specifically, I’ll build a model that more accurately predicts the unit sales for thousands of items sold at different Favorita stores.</em></p><h3>Approach</h3><p>I’ll practice machine learning skills with an approachable training dataset of dates, store, and item information, promotions, and unit sales.</p><h3>Evaluation</h3><p>The evaluation metric for this project is Root Mean Squared Logarithmic Error.</p><p>The RMSLE is calculated as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*DqdGhFSu3UUmOhe0lp_F6g.png" /></figure><p>In this project, I am going to use NumPy, Pandas, Matplotlib, Seaborn, Scikit-learn libraries of Python.</p><p>Here’s an outline of the project:</p><ol><li>Download the Dataset</li><li>Explore &amp; Analyze the Dataset</li><li>Prepare the Dataset for ML Training</li><li>Train Hardcoded &amp; Baseline Models</li><li>Train &amp; Evaluate Different Model</li><li>Hyperparameter Tuning</li><li>Final model</li><li>Make predictions &amp; submit to Kaggle</li><li>Summary &amp; conclusion</li><li>Future Work Ideas</li><li>References</li></ol><h3>1. Download the Dataset</h3><p>I will follow the following steps:</p><ul><li>Download data from Kaggle</li><li>View dataset files</li><li>Load training set with Pandas</li><li>Load test set with Pandas</li></ul><p>We are performing on the Kaggle notebook, so we will use the predefined function of Kaggle to use the data.</p><h4>Download data from Kaggle</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D7&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D7&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/06f5b38ce3ffb1e0b75c1794d39d7aad/href">https://medium.com/media/06f5b38ce3ffb1e0b75c1794d39d7aad/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D8&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D8&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/43a0ee7ae5b6e042f19ce854fc8c95e7/href">https://medium.com/media/43a0ee7ae5b6e042f19ce854fc8c95e7/href</a></iframe><h4>View Dataset Files</h4><p>Let’s look at the size, no. of lines and first few lines of each file.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D10-24&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D10-24&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/bbcdd8e50138ddd90e45422ff9de2c16/href">https://medium.com/media/bbcdd8e50138ddd90e45422ff9de2c16/href</a></iframe><p>Observations:</p><ul><li>This is supervised learning regression problem.</li><li>Training data has 3 million+ rows.</li><li>Test data has 28k rows (&lt; 3000000 rows).</li><li>Training data has 6 columns.</li><li>id</li><li>date</li><li>store_nbr</li><li>family</li><li>onpromotion</li><li>sales</li><li>holidays_events data has 6 columns:</li><li>date</li><li>type</li><li>locale</li><li>locale_name</li><li>description</li><li>transferred</li><li>oil data has 2 columns:</li><li>date</li><li>dcoilwtico</li><li>store data has 5 columns:</li><li>store_nbr</li><li>city</li><li>state</li><li>type</li><li>cluster</li><li>transactions data has 3 columns:</li><li>date</li><li>store_nbr</li><li>transactions</li><li>The test set has all columns from training set except sales column.</li><li>The submission file should have id &amp; sales for each test_sample.</li></ul><h4>Load Training set with Pandas</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D27-30&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D27-30&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c08dafb08c298f3f88a9bc07506c3ac/href">https://medium.com/media/6c08dafb08c298f3f88a9bc07506c3ac/href</a></iframe><h4>Load Test set with Pandas</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D32-33&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D32-33&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/1409687e9f81f26623214cc75274cb10/href">https://medium.com/media/1409687e9f81f26623214cc75274cb10/href</a></iframe><h3>2. Explore &amp; Analyze the Dataset</h3><p>These are the steps that I am going to follow:</p><ul><li>Basic information about the training set</li><li>Basic information about the test set</li><li>Adding different features</li><li>Exploratory data analysis &amp; visualization</li><li>Ask &amp; answer questions</li></ul><h4>Basic information about the training set</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D36-39&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D36-39&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/a1e4b7ca6c6e043e357d47b5c35c9cbb/href">https://medium.com/media/a1e4b7ca6c6e043e357d47b5c35c9cbb/href</a></iframe><p>Observations:</p><ul><li>Memory usage is 114.5+ MB.</li><li>No. of rows 3000888 as expected.</li><li>No missing data.</li><li>store_nbr ranges from 1 to 54.</li><li>sales ranges from $0 to $124717.</li><li>onpromotion ranges from 0 to 741.</li><li>Dateranges from 1 January 2013 to 15 August 2017.</li></ul><h4>Basic information about the test set</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D42-45&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D42-45&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/069ea9f02fbca9eba85ee9a3c821063b/href">https://medium.com/media/069ea9f02fbca9eba85ee9a3c821063b/href</a></iframe><p>Observations:</p><ul><li>Memory usage is 1.1+ MB.</li><li>No. of rows 28512 as expected.</li><li>No missing data.</li><li>store_nbr ranges from 1 to 54.</li><li>onpromotion ranges from 0 to 646.</li><li>There are obvious data entry errors.</li><li>date ranges from 16 august 2017 to 31 August 2017.</li></ul><p>We can use the ranges of test set to drop outliers/invalid data from the training set.</p><h4>Adding different Features</h4><ul><li>Extract parts of the date</li><li>Add store transactions</li><li>Add holidays events</li><li>Add daily oil price</li></ul><h4>Extract parts of the date</h4><ul><li>Year</li><li>Month</li><li>Day</li><li>Weekday</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D49-60&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D49-60&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d93fe0b9831467fe1e7ccfdd01fc802/href">https://medium.com/media/6d93fe0b9831467fe1e7ccfdd01fc802/href</a></iframe><h4>Exploratory Data Analysis &amp; Visualization</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D62-63&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D62-63&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/53a484483e0817e8b14a9caa89c09ee8/href">https://medium.com/media/53a484483e0817e8b14a9caa89c09ee8/href</a></iframe><p>As the size of the dataset is too large, we will work with the sample data for our training.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D65-66&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D65-66&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e29e643bda33ddbc1f996629ed8a434/href">https://medium.com/media/5e29e643bda33ddbc1f996629ed8a434/href</a></iframe><p>Being more than 50% of the data missing for type_y, locale, locale_name, description, transferred, it is neither good to impute these columns nor to have these columns for the prediction. Let’s drop these columns from the train_df.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D68-71&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D68-71&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/491f546c565a35a9681f9b202704060f/href">https://medium.com/media/491f546c565a35a9681f9b202704060f/href</a></iframe><p>As the missing data is less than 30%, we can proceed further.</p><p><strong>Year</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D74&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D74&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c667e60110b1d10a83670d9a0f3597d/href">https://medium.com/media/3c667e60110b1d10a83670d9a0f3597d/href</a></iframe><p>There are higher number of records for year 2016 as expected than 2017 in the training data.</p><p><strong>Family</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D77&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D77&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/354ac43abe5047bb8dd87549ef9dbf4d/href">https://medium.com/media/354ac43abe5047bb8dd87549ef9dbf4d/href</a></iframe><p>There is uniform distribution of the product family.</p><p><strong>Store_nbr</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D80&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D80&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c50c26431c0d10d59eb3a0a91b4ab8c/href">https://medium.com/media/9c50c26431c0d10d59eb3a0a91b4ab8c/href</a></iframe><p>There is uniform distribution of store_nbr in the training data.</p><p><strong>onpromotion</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D83&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D83&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/c6343c4d845bf6775837af1a53f52c7d/href">https://medium.com/media/c6343c4d845bf6775837af1a53f52c7d/href</a></iframe><p>onpromotion follows an exponential decreasing distribution.</p><p><strong>Sales</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D86&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D86&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/19150fb0f8e71ce5fbed2dff974d22ce/href">https://medium.com/media/19150fb0f8e71ce5fbed2dff974d22ce/href</a></iframe><p>Sales follows an exponential decreasing distribution.</p><p><strong>Daily Oilprice</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D89&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D89&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/442f53f5399fc0272728b7960c06ebde/href">https://medium.com/media/442f53f5399fc0272728b7960c06ebde/href</a></iframe><p>Daily Oilprice follows a left skewed normal distribution.</p><p><strong>Store_nbr vs sales</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D92&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D92&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/509427dfe1b985c3945f08c8cc240a83/href">https://medium.com/media/509427dfe1b985c3945f08c8cc240a83/href</a></iframe><p>Insight: store_nbr 44 has the highest sales.</p><p><strong>Family vs sales</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D95&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D95&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa24b3ab06131fe5cfa1ecc097bb7e2b/href">https://medium.com/media/aa24b3ab06131fe5cfa1ecc097bb7e2b/href</a></iframe><p>Insight: Grocery I has much higher sales than any other product family followed by Beverages.</p><p><strong>Transactions vs sales</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D98&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D98&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/a81d341564482ae33bcdf25605991702/href">https://medium.com/media/a81d341564482ae33bcdf25605991702/href</a></iframe><p>Insight: There is positive correlation between transactions and sales.</p><p><strong>Daily Oilprice vs sales</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D101&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D101&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9d344f3282bf97214edf82781b85296/href">https://medium.com/media/f9d344f3282bf97214edf82781b85296/href</a></iframe><p>Insight: It is hard to decide the correlation between daily oilprice and sales.</p><p><strong>Store type (type_x) vs sales</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D104&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D104&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/04ea1d184b25871f19d7a11bf9e26c9a/href">https://medium.com/media/04ea1d184b25871f19d7a11bf9e26c9a/href</a></iframe><p>Insight: Store type A has the highest sales.</p><p><strong>Citywise sales</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D107&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D107&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/2dacbfe2c2199232d1e36d0fb5d9af9e/href">https://medium.com/media/2dacbfe2c2199232d1e36d0fb5d9af9e/href</a></iframe><p>Insight: Quito city has the highest sales followed by Cayambe.</p><p><strong>Statewise sales</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D110&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D110&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0d09ca2ebc92ee63e86d6d8246a99c4/href">https://medium.com/media/b0d09ca2ebc92ee63e86d6d8246a99c4/href</a></iframe><p>Insight: State Pichincha has the highest sales.</p><p><strong>Correlation between 2 variables</strong></p><p>It is defined as the linear relationship between 2 variables, which give us direction &amp; strength of the relationship.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D113&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D113&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/75c4d581528b6f10dc5e7fb63d1d207d/href">https://medium.com/media/75c4d581528b6f10dc5e7fb63d1d207d/href</a></iframe><p>There is positive correlation in transactions and sales. Therefore, it is good to drop transactions from the train_df as the model can get the idea of sales from transactions feature.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D115-116&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D115-116&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/1b9d827a54f7720352ea11a13b323451/href">https://medium.com/media/1b9d827a54f7720352ea11a13b323451/href</a></iframe><p>Insight: There is high correlation of sales with onpromotion, dcoilwtico, year, store_nbr, weekday, cluster.</p><h4>Ask &amp; Answer Questions</h4><ol><li><strong>Which month has the highest sales? Which day of the month has highest sales? Which weekday has the highest sales?</strong></li></ol><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D119-121&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D119-121&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/62b1ac2b13b126fbf906523b3f5d1961/href">https://medium.com/media/62b1ac2b13b126fbf906523b3f5d1961/href</a></iframe><p>December month has the highest sales. 2nd day of the month has the highest sales. 6th day i.e. Sunday has the highest sales.</p><p><strong>2. What is the trend of sales according to years? Does the same trend follows for different kinds of products (Family) also?</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D124-125&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D124-125&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b0118c29f7583ef739a094355a628fc/href">https://medium.com/media/6b0118c29f7583ef739a094355a628fc/href</a></iframe><p>Sales is increasing yearly. Sales follows the same trend for different kinds of product families.</p><h3>3. Prepare the Dataset for ML Training</h3><p>I am going to follow these steps:</p><ul><li>Split Training &amp; Validation Set</li><li>Fill/Remove Missing Values</li><li>Extract Inputs &amp; Outputs</li><li>Training</li><li>Validation</li><li>Test</li><li>Preprocessing the data</li></ul><h4>Split Training &amp; Validation Set</h4><p>We will set aside the data having year 2017 for validation set as this is time-series dataset so we can’t just randomly put aside 20% of the dataset for validation.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D131-132&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D131-132&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/8556bd08e9e1b6963e68e081af7c5403/href">https://medium.com/media/8556bd08e9e1b6963e68e081af7c5403/href</a></iframe><h4>Fill Missing Values</h4><p>Let’s check missing percentage of data.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D135&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D135&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b65dc802fdb61d6bbbeab0f321df2191/href">https://medium.com/media/b65dc802fdb61d6bbbeab0f321df2191/href</a></iframe><p>I will use median of daily oilprice to impute the missing values. Distribution of dcoilwtico is left skewed, here mean is not a good measure of central tendency, hence I am using median.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D137-146&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D137-146&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/eba35160676769e2f4f11052328cfb15/href">https://medium.com/media/eba35160676769e2f4f11052328cfb15/href</a></iframe><h4>Extract Inputs &amp; Outputs</h4><p>Before extract inputs and outputs, let’s convert categorical data from int/float to object such as store_nbr, year, month, day, etc.</p><pre>train_df[[&#39;store_nbr&#39;,&#39;year&#39;,&#39;month&#39;,&#39;day&#39;,&#39;weekday&#39;,&#39;cluster&#39;]]=train_df[[&#39;store_nbr&#39;,&#39;year&#39;,&#39;month&#39;,&#39;day&#39;,&#39;weekday&#39;,&#39;cluster&#39;]].astype(&#39;object&#39;)</pre><pre>val_df[[&#39;store_nbr&#39;,&#39;year&#39;,&#39;month&#39;,&#39;day&#39;,&#39;weekday&#39;,&#39;cluster&#39;]]=val_df[[&#39;store_nbr&#39;,&#39;year&#39;,&#39;month&#39;,&#39;day&#39;,&#39;weekday&#39;,&#39;cluster&#39;]].astype(&#39;object&#39;)</pre><pre>test_df[[&#39;store_nbr&#39;,&#39;year&#39;,&#39;month&#39;,&#39;day&#39;,&#39;weekday&#39;,&#39;cluster&#39;]]=test_df[[&#39;store_nbr&#39;,&#39;year&#39;,&#39;month&#39;,&#39;day&#39;,&#39;weekday&#39;,&#39;cluster&#39;]].astype(&#39;object&#39;)</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D155-157-157&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D155-157-157&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/d08c356d20e3ecc2498492453219df46/href">https://medium.com/media/d08c356d20e3ecc2498492453219df46/href</a></iframe><p><strong>Training</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D159-162&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D159-162&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/051ca432534480df239a612fceed1d02/href">https://medium.com/media/051ca432534480df239a612fceed1d02/href</a></iframe><p><strong>Validation</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D164-168&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D164-168&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/033f958b78ba1ce99626c66351de908b/href">https://medium.com/media/033f958b78ba1ce99626c66351de908b/href</a></iframe><p><strong>Test</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D170-171&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D170-171&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/96cfdf6d13d7548a1270cf4f24da3067/href">https://medium.com/media/96cfdf6d13d7548a1270cf4f24da3067/href</a></iframe><h4>Preprocessing</h4><p>Let’s convert categorical data (object) to one hot encoding as machine learning model can handle only numbers.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D174-183&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D174-183&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/469035c4de35afbdf57d1b271adec760/href">https://medium.com/media/469035c4de35afbdf57d1b271adec760/href</a></iframe><h3>4. Train Hardcoded &amp; Baseline Models</h3><ul><li>Hardcoded model: Always predict average sales</li><li>Baseline model: Decision Tree Regression</li></ul><p>For evaluation the dataset uses Root Mean Squared Logarithmic Error (RMSLE): <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fscikit-learn.org%2Fstable%2Fmodules%2Fgenerated%2Fsklearn.metrics.mean_squared_log_error.html">check</a></p><h4>Hardcoded Model</h4><p>Let’s create a simple model that always predict the average.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D186-200&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D186-200&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/40204d7fa7a8c932c8eb2076f9b5c4ce/href">https://medium.com/media/40204d7fa7a8c932c8eb2076f9b5c4ce/href</a></iframe><p>Our dump hard-coded model is off by 3.589 on average, which is pretty good considering the average sale is 3.589 on average, which is pretty good considering the average sale is 446.518.</p><h4>Baseline Model</h4><p>I haven’t trained using linear regression model, as the distribution of sales doesn’t follows a normal distribution, hence it won’t give much better result than simply predicting the averages.</p><p>I will train decision tree regression model as our baseline model. However, now we have a baseline model that our other models should ideally beat.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D204-210&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D204-210&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/323f07a29abfb51febbfcd7b96f07721/href">https://medium.com/media/323f07a29abfb51febbfcd7b96f07721/href</a></iframe><p>Training Error is 0.3389 and Validation error is 0.8306 which is better than predicting average sales.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D212-213&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D212-213&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b215764cd31cbdb5662bd817cf537e7/href">https://medium.com/media/6b215764cd31cbdb5662bd817cf537e7/href</a></iframe><h3>5. Train &amp; Evaluate Different Model</h3><h4>RandomForest Regressor</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D216-224&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D216-224&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b852bbbe615ee3a2ac1914aa080b4a7a/href">https://medium.com/media/b852bbbe615ee3a2ac1914aa080b4a7a/href</a></iframe><p>Training Error is 0.4203 and Validation error is 0.7167 which is better than the baseline model’s result.</p><h3>6. Hyperparameter Tuning</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D228-229&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D228-229&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c49ba9b3c632771c4e7a7abe9c6c6d6/href">https://medium.com/media/4c49ba9b3c632771c4e7a7abe9c6c6d6/href</a></iframe><h4>Min Samples leaf</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D231&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D231&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c75dbd613fac796a86a2a5a5b047e88/href">https://medium.com/media/2c75dbd613fac796a86a2a5a5b047e88/href</a></iframe><p>For the hyperparameter min_samples_leaf, 9 is the giving the optimal solution.</p><h4>Max Features</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D234&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D234&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/ceb58ae6f878587df7c032594ae5af73/href">https://medium.com/media/ceb58ae6f878587df7c032594ae5af73/href</a></iframe><p>From the above graph, 80% of the features i.e 0.8 as the value of max_features is the giving the optimal solution.</p><h3>7. Final Model</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D237-244&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D237-244&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/fdc5309a16ec70079f10093bbb17da39/href">https://medium.com/media/fdc5309a16ec70079f10093bbb17da39/href</a></iframe><p>Training Error is 0.5454 and Validation error is 0.6573 for the final model.</p><h3>8. Make Predictions and Submit to Kaggle</h3><p>I will follows these steps:</p><ul><li>Make predictions for test set</li><li>Generate submission csv</li><li>Submit to Kaggle</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D248-249&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fproject3%2Fv%2F2%26cellId%3D248-249&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe9401f0934e14799bba695221e4069f0%2Fpreview%2F19a2e76fe567437a83e501f53ebaa910&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/062786c8d7b49334e9942092d909deb2/href">https://medium.com/media/062786c8d7b49334e9942092d909deb2/href</a></iframe><p>Hence, the final model is giving us $0.66861 away from the original sales for the test set.</p><h3>9. Summary &amp; Conclusion:</h3><ul><li>Problem Statement: We have to use time-series forecasting to forecast store sales on data from Corporación Favorita, a large Ecuadorian-based grocery retailer. Specifically, we’ll build a model that more accurately predicts the unit sales for thousands of items sold at different Favorita stores.</li><li>Evaluation: The evaluation metric for this project is Root Mean Squared Logarithmic Error which is calculated as:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*DqdGhFSu3UUmOhe0lp_F6g.png" /></figure><ul><li>These are the results of the models:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*YFQFl9lFJZj_Cjszo43Snw.png" /></figure><ul><li>Important features for predicting the sales are family_Grocery_I, family_Beverages, family_produce, state_Pichincha, type_x_A (store type A), onpromotion, dcoilwtico, city_Quito, weekday_6 (sunday), family_cleaning which were expected from the exploratotory analysis of the data.</li><li>Kaggle score is 0.66861.</li></ul><h3>10. Future Work Ideas</h3><ul><li>Perform feature engineering like seasonality feature to get better results.</li><li>Can do more hyperparameter tuning and regularization to decrease the error.</li></ul><h3>11. References</h3><ul><li>How to approch machine learning problem: <a href="https://jovian.ai/learn/zero-to-data-analyst-bootcamp/lesson/how-to-approach-machine-learning-problems">https://jovian.ai/learn/zero-to-data-analyst-bootcamp/lesson/how-to-approach-machine-learning-problems</a></li><li>Decision Trees &amp; Random Forest: <a href="https://jovian.ai/learn/zero-to-data-analyst-bootcamp/lesson/decision-trees-and-random-forests">https://jovian.ai/learn/zero-to-data-analyst-bootcamp/lesson/decision-trees-and-random-forests</a></li><li>Exploratory Data Analysis Case Study: <a href="https://jovian.ai/learn/zero-to-data-analyst-bootcamp/lesson/exploratory-data-analysis-case-study">https://jovian.ai/learn/zero-to-data-analyst-bootcamp/lesson/exploratory-data-analysis-case-study</a></li><li>Visualization with Matplotlib &amp; Seaborn: <a href="https://jovian.ai/learn/zero-to-data-analyst-bootcamp/lesson/visualization-with-matplotlib-and-seaborn">https://jovian.ai/learn/zero-to-data-analyst-bootcamp/lesson/visualization-with-matplotlib-and-seaborn</a></li><li>Datetime in Pandas: <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fpsgpyc.medium.com%2Fdatetime-in-pandas-read-csv-everything-you-have-to-know-8245bd048fa">https://psgpyc.medium.com/datetime-in-pandas-read-csv-everything-you-have-to-know-8245bd048fa</a></li><li>Different ways to convert datatypes: <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fsparkbyexamples.com%2Fpandas%2Fpandas-change-column-data-type-dttype%2F">https://sparkbyexamples.com/pandas/pandas-change-column-data-type-dttype/</a></li><li>Sklearn Library: <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fscikit-learn.org%2Fstable%2F">https://scikit-learn.org/stable/</a></li></ul><p>Hoping you enjoyed reading the article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90ecc58c43e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploratory Data Analysis of Indian Companies Registration]]></title>
            <link>https://medium.com/@kshamasinghal/exploratory-data-analysis-of-indian-companies-registration-a7f042a676ca?source=rss-4a27dccb1e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7f042a676ca</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[exploratory-data-analysis]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-analysis]]></category>
            <dc:creator><![CDATA[Kshama Singhal]]></dc:creator>
            <pubDate>Thu, 29 Sep 2022 11:16:12 GMT</pubDate>
            <atom:updated>2022-11-04T06:10:48.343Z</atom:updated>
            <content:encoded><![CDATA[<h4>Data Science</h4><h4>Gain an in-depth understanding of Indian business firms</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/0*uqGonCnl-BSKPEmv.png" /></figure><pre><strong>Index Of Contents</strong><br>☞ <a href="#3240">Download the Data</a><br>☞ <a href="#2a3e">Data Preparation and Cleaning</a><br>☞ <a href="#d0c8">Exploratory Analysis and Visualization</a><br>☞ <a href="#6199">1. COMPANY_STATUS</a><br>☞ <a href="#c0b2">2. COMPANY_CLASS</a><br>☞ <a href="#daba">3. COMPANY_CATEGORY</a><br>☞ <a href="#93ad">4. COMPANY_SUB_CATEGORY</a><br>☞ <a href="#cfa1">5. DATE_OF_REGISTRATION</a><br>☞ <a href="#85ee">6. REGISTERED_STATE</a><br>☞ <a href="#deca">7. AUTHORIZED_CAP</a><br>☞ <a href="#cdda">8. PAIDUP_CAPITAL</a><br>☞ <a href="#edfb">9. PRINCIPAL_BUSINESS_ACTIVITY_AS_PER_CIN</a><br>☞ <a href="#7ed0">Ask &amp; Answer Questions</a><br>☞ <a href="#974e">1. Which 5 states have the highest number of companies registered?</a><br>☞ <a href="#83f6">2. Which are the top 5 registered principal business activities?</a><br>☞ <a href="#79b4">3. What is the trend of companies registered as per principal business activity year over year?</a><br>☞ <a href="#90bf">4. What is the status of most of the companies currently (2020) having highest Paidup capital? Which are the top 5 states having highest number of active companies?</a><br>☞ <a href="#5af7">5. Are the most companies Private or Public having highest paidup capital? Which are the top 5 states having Public companies? Which are the top 5 states having Private companies?</a><br> ☞ <a href="#954d">6. Which are the top 5 companies according to authorized cap? Are the same companies among top 5 according to Paidup capital also?</a><br> ☞ <a href="#098d">7. Is there any trend monthwise registration? Which month has the highest number of registration and which month has the lowest number of registration? What can be the reason of the highest registration for the month?</a><br> ☞ <a href="#6454">8. What are the top 5 business activities in Meghalaya?</a><br> ☞ <a href="#d057">Summary and Conclusion</a><br> ☞ <a href="#75a4">Future Work Ideas</a><br> ☞ <a href="#0a13">References</a></pre><p>Exploratory Data Analysis (EDA) is the process of exploring, investigating, and gathering insights from data using statistical measures and visualizations. The objective of EDA is to develop, an understanding of data, by uncovering trends, relationships, and patterns.</p><p>Companies play an important role in a nation’s growth.</p><p>Exploration is the engine that drives innovation. Innovation drives economic growth. So let’s all go exploring. -Edith Widder</p><p>We will explore Indian companies&#39; registration from 1857 to 2020. The dataset that we are going to use in the project is from <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fwww.kaggle.com%2F">Kaggle</a>.</p><p>Data contains various information like Corporate Identification Number(CIN), Company Name, Company Status, Company Class, Company Category, Authorized Capital in INR, Paid-up Capital in INR, Date of Registration, Registered State, Registrar of Companies, Principal Business Activity, Registered Office Address and Sub Category.</p><p>There are 1.9+ million rows and 17 columns.</p><p>In this project, we are going to use <a href="https://numpy.org/doc/stable/user/index.html">Numpy</a>, <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fpandas.pydata.org%2Fdocs%2Fuser_guide%2Findex.html">Pandas</a>, <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fmatplotlib.org%2Fstable%2Findex.html">Matplotlib</a>, <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fseaborn.pydata.org%2Ftutorial.html">Seaborn</a>, <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fplotly.com%2Fpython%2F">Plotly</a>, <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fgithub.com%2FJovianML%2Fopendatasets">opendatasets</a> libraries of Python.</p><p>Here is the outline of the project:<br>▸Download the Data<br>▸Data Preparation and Cleaning<br>▸Exploratory Analysis and Visualization<br>▸Ask &amp; Answer Questions<br>▸Summary &amp; Conclusion<br>▸Future Work Ideas<br>▸References</p><p>You can find the complete code for this project <a href="https://jovian.ai/singhalkshama4343/exploratory-data-analysis-project">here</a>.</p><p>First install important libraries that we are going to use i.e. Numpy for numerical calculation, Pandas for handling dataframes, Matplotlib, Plotly, and Seaborn for visualization.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F52%26cellId%3D3&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F52%26cellId%3D3&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F7fa997fb361345f5930f1c22cd72c600&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8a36a998d111daa6ce380064e9586e8/href">https://medium.com/media/d8a36a998d111daa6ce380064e9586e8/href</a></iframe><p>Importing libraries.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D5&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D5&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5a8282b4e95b1e71f8d72969f8bea94/href">https://medium.com/media/b5a8282b4e95b1e71f8d72969f8bea94/href</a></iframe><h3>Download the Data</h3><p>We will use opendatasets library for downloading the data. It is an effective and easy way to download the data from kaggle.</p><p>So, first install opendatasets.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D8&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D8&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc15328cdadab6a2b668f2b5f2905ff3/href">https://medium.com/media/cc15328cdadab6a2b668f2b5f2905ff3/href</a></iframe><p>We have to provide the link for the data in od.download function as an argument. It will ask for username and kaggle key that you can generate by clicking on your kaggle profile. There go to your account and click on ‘Create New API Token` available in API. The fill will be downloaded as json file so upload it on the jupyter notebook.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D10&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D10&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c03b137c27be2b0989aba18b8d44d79/href">https://medium.com/media/8c03b137c27be2b0989aba18b8d44d79/href</a></iframe><p>Now, provide the data file’s path. That you can get by following the below method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/0*891AhgVrrPIIZJKU.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D12&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D12&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/e745070671eeea41f88e76ba664145a7/href">https://medium.com/media/e745070671eeea41f88e76ba664145a7/href</a></iframe><h3>Data Preparation and Cleaning</h3><p>Before starting to analyze and visualize the data we have to look up the file, its columns and their information. We have to go through data to see if there is significant values available.</p><p>We will use Pandas library to read the csv file.</p><pre>df=pd.read_csv(data_filename)</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D16&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D16&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/e0003964030f7ae3081ee421e5357217/href">https://medium.com/media/e0003964030f7ae3081ee421e5357217/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D18&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D18&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/278b15cea832d24c792cdb70666dae42/href">https://medium.com/media/278b15cea832d24c792cdb70666dae42/href</a></iframe><p>Here is some more information about the data.</p><ol><li>CORPORATE_ IDENTIFICATION_NUMBER — Corporate Identification Number sometimes referred to as CIN is a unique identification number which is assigned by the ROC (Registrar of Companies) of various states under the MCA (Ministry of Corporate Affairs).</li></ol><p>2. COMPANY_NAME — Name of the company.</p><p>3. COMPANY_STATUS — The ‘Status’ tell the current state of the company. Whether it is active and operating or dormant or it has been struck off and closed. There are 13 such status that a company could be carrying:</p><ul><li>ACTV — Active</li><li>NAEF — Not available for e-filing</li><li>ULQD — Under liquidation</li><li>AMAL — Amalgamated</li><li>STOF — Strike off</li><li>DISD — Dissolved</li><li>CLLD — Converted to LLP and Dissolved</li><li>UPSO — Under process of Striking Off</li><li>CLLP — Converted to LLP</li><li>LIQD — Liquidated</li><li>DRMT — Dormant</li><li>MLIQ — Vanished</li><li>D455 — Dormant under section 455</li></ul><p>4. COMPANY_CLASS — Companies are primarily classified into private and public. Private companies or private limited companies are those companies that are closely-held and have less than 200 shareholders. Public companies are limited companies that have more than 200 shareholders and are listed on a stock exchange.</p><ul><li>Public</li><li>Private</li><li>Private (One Person Company)</li></ul><p>5. COMPANY_CATEGORY — The category of the company.</p><ul><li>Company limited by Shares</li><li>Company Limited by Guarantee</li><li>Unlimited Company</li></ul><p>6. COMPANY_SUB _CATEGORY — The sub-category of the company.</p><ul><li>Non-govt company</li><li>State Govt company</li><li>Subsidiary of Foreign Company</li><li>Guarantee and Association comp</li><li>Union Govt company</li></ul><p>7. DATE OF REGISTRATION — Date of registration of the company.</p><p>8. REGISTERED_STATE — State in which company was registered.</p><p>9. AUTHORIZED_CAP — Authorized Capital of the company (INR) (This capital of a company is the maximum amount of share capital that the company is authorised by its constitutional documents to issue to shareholders.)</p><p>10. PAIDUP_CAPITAL — Paid Up Capital of the company (INR) (This capital is the amount of money a company has received from shareholders in exchange for shares of stock)</p><p>11. INDUSTRIAL_CLASS — Industrial class of the company as per NIC 2004.</p><p>12. PRINCIPAL_ BUSINESS_ACTIVITY <em>AS</em> PER_CIN — Principal Business Activity of the company as per CIN.</p><p>13. REGISTERED_OFFICE _ADDRESS — Registered office address of the company.</p><p>14. REGISTRAR_OF _COMPANIES — Registrar office of the company.</p><p>15. EMAIL_ADDR — Email address of the companies owner/director.</p><p>16. LATEST_YEAR _ANNUAL _RETURN — Annual return of the last year.</p><p>17. LATEST_YEAR _FINANCIAL _STATEMENT — Financial Statement of the last year.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D20&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D20&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff720359125b659246817934ea187c1c/href">https://medium.com/media/ff720359125b659246817934ea187c1c/href</a></iframe><p>Using the df.describe() function we have got statistical information about the numerical columns i.e. Authorized Cap and Paidup Capital. As Paidup Capital is always less than equal to Authorized Cap and it is clearly visible from the above information.</p><p>Before making our analyses we have to check missing values percentage. Then accordingly clean and handle the missing values.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D23&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D23&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a342947f29b57f37ccf4fd992a09013/href">https://medium.com/media/5a342947f29b57f37ccf4fd992a09013/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D25&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D25&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/81b77b6e0a10de0d3bf064bac89b58e3/href">https://medium.com/media/81b77b6e0a10de0d3bf064bac89b58e3/href</a></iframe><p>As 41% of the Latest Year Annual Return &amp; Latest Year Financial Statement values are missing which is more than 30%. Therefore, we will drop these two columns and the column containing email address to make aur analyses better.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D27&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D27&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/215f6d991dfee291b25aae138fbd2b47/href">https://medium.com/media/215f6d991dfee291b25aae138fbd2b47/href</a></iframe><p>Check whether all the values are unique or is there any duplicate value so that we can make decision to deal with duplicate values. To check total number of duplicate rows use df.dupicated().sum().</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D29&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D29&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/f853c7bbb6509aa625f6de18b2862c76/href">https://medium.com/media/f853c7bbb6509aa625f6de18b2862c76/href</a></iframe><p>As there is no duplicate rows we can proceed further to analyze the data.</p><h3>Exploratory Analysis and Visualization</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D32&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D32&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c7a90b4e27fe7845686627264bd4bec/href">https://medium.com/media/3c7a90b4e27fe7845686627264bd4bec/href</a></iframe><p>These are the remaining columns after removing some columns from the original dataset.</p><p>Columns we’ll analyze</p><ol><li>Company_Status</li><li>Company_Class</li><li>Company_Category</li><li>Company_Sub_Category</li><li>Date_of_Registration</li><li>Registered_State</li><li>Authorized_Cap</li><li>Paidup_Capital</li><li>Principal_Business_Activity_As_Per_CIN</li></ol><h4>1. COMPANY_STATUS</h4><p>The Status tells the current state of the company. Whether it is active and operating or dormant or it has been struck off and closed. There are 13 such status that a company could be carrying.</p><ul><li>ACTV — Active</li><li>NAEF — Not available for e-filing</li><li>ULQD — Under liquidation</li><li>AMAL — Amalgamated</li><li>STOF — Strike off</li><li>DISD — Dissolved</li><li>CLLD — Converted to LLP and Dissolved</li><li>UPSO — Under process of Striking Off</li><li>CLLP — Converted to LLP</li><li>LIQD — Liquidated</li><li>DRMT — Dormant</li><li>MLIQ — Vanished</li><li>D455 — Dormant under section 455</li></ul><p>We are checking percentage of companies with particular status.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D37&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D37&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d11a884c77780927fa119f1cacc41f5/href">https://medium.com/media/8d11a884c77780927fa119f1cacc41f5/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D38&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D38&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e648c42594772b428c977d22109fbeb/href">https://medium.com/media/3e648c42594772b428c977d22109fbeb/href</a></iframe><p>Insight: Approx 60% of the companies are active as of the year 2020.</p><h4>2. COMPANY_CLASS</h4><p>Companies are primarily classified into private and public. Private companies or private limited companies are those companies that are closely-held and have less than 200 shareholders. Public companies are limited companies that have more than 200 shareholders and are listed on a stock exchange.</p><ul><li>Public</li><li>Private</li><li>Private (One Person Company)</li></ul><p>Let’s check number of number with particular class.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D42&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D42&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c287e54299ea56ddb3caa5de2fbe37e/href">https://medium.com/media/7c287e54299ea56ddb3caa5de2fbe37e/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D43&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D43&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/c415744507486a9812f37899badfe33f/href">https://medium.com/media/c415744507486a9812f37899badfe33f/href</a></iframe><p>Insight: Approx 92% of the companies are Private.</p><h4>3. COMPANY_CATEGORY</h4><p>These are categories of the company.</p><ul><li>Company limited by Shares</li><li>Company Limited by Guarantee</li><li>Unlimited Company</li></ul><p>Let’s check the percentage of companies having particular category.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D47&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D47&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/3be2ca6a9dffa7a75ae446a335f13f52/href">https://medium.com/media/3be2ca6a9dffa7a75ae446a335f13f52/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D48&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D48&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/9362508e01d54c6d637ca78dd2217d59/href">https://medium.com/media/9362508e01d54c6d637ca78dd2217d59/href</a></iframe><p>Insights:</p><ul><li>Approx 96% of the companies are limited by Shares.</li><li>Approx very less than 1% of companies are unlimited company.</li><li>Nearly 2% of the companies hold position in limited by Guarantee.</li></ul><h4>4. COMPANY_SUB_CATEGORY</h4><p>The sub-category of the company:</p><ul><li>Non-govt company</li><li>State Govt company</li><li>Subsidiary of Foreign Company</li><li>Guarantee and Association comp</li><li>Union Govt company</li></ul><p>Let’s check the percentage of companies with particular sub-category.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D52&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D52&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/764d7e2de8cd3fcf96a8940ec8ca1379/href">https://medium.com/media/764d7e2de8cd3fcf96a8940ec8ca1379/href</a></iframe><p>Insight: Approx 99% of the companies are Non-Government.</p><h4>5. DATE_OF_REGISTRATION</h4><p>First, we will check Date of Registration’s datatype. It should be datetime if it is not we have to convert it into datetime datatype to get useful insights from the data.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D55&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D55&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/6687c761acfcd4728367714f456ff85c/href">https://medium.com/media/6687c761acfcd4728367714f456ff85c/href</a></iframe><p>Hence, the datatype of Date of Registration is object.</p><p>Let’s convert it into datetime. Then will check number of registrations yearwise.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D57&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D57&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0022a436d4ff4d62edd936d874b7afa/href">https://medium.com/media/b0022a436d4ff4d62edd936d874b7afa/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D58&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D58&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2dd14bd1a00f4d97b95840c65ba0922/href">https://medium.com/media/b2dd14bd1a00f4d97b95840c65ba0922/href</a></iframe><p>To check number of registration according to days. We will use dt.day_name() function then convert the series into dataframe then change the datatype of the day column to categorical.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D60&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D60&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/94015b638e78c047b027847b8cd3984c/href">https://medium.com/media/94015b638e78c047b027847b8cd3984c/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D61&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D61&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/d5bbe1d98fe9b432d05556eed8253d5d/href">https://medium.com/media/d5bbe1d98fe9b432d05556eed8253d5d/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D62&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D62&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/83fe7818a8dc498480bca5930766373d/href">https://medium.com/media/83fe7818a8dc498480bca5930766373d/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D63&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D63&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/e351235474b7d5795a60ad6e85a73d47/href">https://medium.com/media/e351235474b7d5795a60ad6e85a73d47/href</a></iframe><p>Insights:</p><ul><li>On an average, most of companies registered between 2000 &amp; 2019.</li><li>The highest number of companies(128.658 k) registered in 2019.Then there is drastically decrease in number of companies <a href="https://jovian.ai/outlink?url=http%3A%2F%2Fregistration.In">registration.In</a> March 2020, government announced the lockdown due to covid-19. This could be the reason for decrease in companies registration.</li><li>Almost all days have similar number of companies registration except weekends. Saturday and Sunday has very less number of registration, may be due to weekends as people like to relax, spend time with family and stay away from their professional life. One of the reason could be closing of offices on weekends.</li></ul><h4>6. REGISTERED_STATE</h4><p>State in which company was registered. Let’s first check unique number of states.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D67&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D67&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b464f73897c89d231511a1c1d25461c7/href">https://medium.com/media/b464f73897c89d231511a1c1d25461c7/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D68&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D68&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/5bd031b04360b9a33a2189057e36a47e/href">https://medium.com/media/5bd031b04360b9a33a2189057e36a47e/href</a></iframe><p>Insights:</p><ul><li>Maharashtra is the leading state having highest number of companies registration (395282).</li><li>Sikkim has the lowest number of companies registration (2).</li></ul><h4>7. AUTHORIZED_CAP</h4><p>Authorized capital of a company is the maximum amount of share capital that the company is authorised by its constitutional documents to issue to shareholders.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D71&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D71&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/92bb10a81555cfdae9bd0696a01e402d/href">https://medium.com/media/92bb10a81555cfdae9bd0696a01e402d/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D72&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D72&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/7036f42bebef5c576d9c4885c12ed2fd/href">https://medium.com/media/7036f42bebef5c576d9c4885c12ed2fd/href</a></iframe><p>Insights:</p><ul><li>Rs. 0 is the minimum authorized capital.</li><li>Approx Rs. 999 trilion is the maximum authorized capital.</li></ul><h4>8. PAIDUP_CAPITAL</h4><p>Paidup capital is the amount of money a company has received from shareholders in exchange for shares of stock.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D75&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D75&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b6030f9e94d1262422f48c23e2ab163d/href">https://medium.com/media/b6030f9e94d1262422f48c23e2ab163d/href</a></iframe><p>Insight:</p><ul><li>Most of the companies (873908) have Rs. 1 lakh Paidup capital.</li></ul><h4>9. PRINCIPAL_BUSINESS_ACTIVITY_AS_PER_CIN</h4><p>This is Principal Business Activity of the company as per Corporate Identity Number.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D78&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D78&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/5885456c87a283e37718180febbd0c90/href">https://medium.com/media/5885456c87a283e37718180febbd0c90/href</a></iframe><p>Insights:</p><ul><li>Most of the registered companies has the Real estate renting and business activities as the principal business.</li><li>Least number of registered companies has their principal business is Activities of private households as employers and undifferentiated production activities of private households.</li></ul><h3>Ask &amp; Answer Questions</h3><h4>1. Which 5 states have the highest number of companies registered?</h4><p>To answer this question, first we will generate a dataframe.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D83&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D83&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/bda3a1d762629f4b442f12d70a81a1c6/href">https://medium.com/media/bda3a1d762629f4b442f12d70a81a1c6/href</a></iframe><p>These are some states and union territories whose names has updated. So, let’s replace these names with old names from the dataframe.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D85&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D85&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/ede4ba7889d6314da32ff7166ee00edd/href">https://medium.com/media/ede4ba7889d6314da32ff7166ee00edd/href</a></iframe><p>As now Dadra and Nagar Haveli, and Daman and Diu has merged. Let’s first find number of companies for both the territories separately.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D87&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D87&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/eeabd683e46cf9dba66140ab7d16a74d/href">https://medium.com/media/eeabd683e46cf9dba66140ab7d16a74d/href</a></iframe><p>Let’s combine both the territories and make it one.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D89&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D89&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/4709f6eb15144ce695c3615429d2f291/href">https://medium.com/media/4709f6eb15144ce695c3615429d2f291/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D90&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D90&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4cb20de0adb3f512ae97923dd0e3802/href">https://medium.com/media/c4cb20de0adb3f512ae97923dd0e3802/href</a></iframe><p>Now, let’s drop the old row for Daman and Diu.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D92&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D92&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d8bff6b01b95224d0ea750de4c787e8/href">https://medium.com/media/4d8bff6b01b95224d0ea750de4c787e8/href</a></iframe><p>As, Ladakh is the new territory. Let’s update it in the dataframe.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D94&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D94&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2ccc55709ac527560eb844446319986/href">https://medium.com/media/b2ccc55709ac527560eb844446319986/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D95&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D95&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/27330011c2431133537d0bfff84d8658/href">https://medium.com/media/27330011c2431133537d0bfff84d8658/href</a></iframe><p>We will use Choropleth_mapbox chart from Plotly library. To have the idea about this chart <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fplotly.com%2Fpython%2Fmapbox-county-choropleth%2F">check</a> this. Hover over the chart to get more information.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D97&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D97&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/1945cacffc39546491aa9d32469c7a37/href">https://medium.com/media/1945cacffc39546491aa9d32469c7a37/href</a></iframe><p>Hence, Maharashtra has the highest number of companies registered (395.282k) followed by Delhi (348.230k), West Bengal (207.007k), Tamil Nadu (150.871k), Karnataka (125.779k).</p><h4>2. Which are the top 5 registered principal business activities?</h4><p>First, we will convert companies_business_activity series to dataframe and change the column names.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D101&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D101&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7581220df1b60904eb92b18edc26d16/href">https://medium.com/media/f7581220df1b60904eb92b18edc26d16/href</a></iframe><p>Let’s visualize the data using pie chart from Plotly library. To interact more with the chart hover over the chart.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D103&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D103&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/e58ad91470c506d6df68476f18086952/href">https://medium.com/media/e58ad91470c506d6df68476f18086952/href</a></iframe><p>Hence, it is clear from the above chart that 34.1% is highest percentage. The top principal business activity is Real estate renting and business activities (679,955) followed by Manufacturing (410,402), Wholesale and retail trade repair of motor vehicles motorcycles and personal household goods (227,333), Construction (162,125), Financial intermediation (120,714).</p><h4>3. What is the trend of companies registered as per principal business activity year over year?</h4><p>To answer this question, we are going to seaborn library and its histogram plot.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D107&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D107&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa0d9f568e7f216c2ee398e9418f8684/href">https://medium.com/media/fa0d9f568e7f216c2ee398e9418f8684/href</a></iframe><p>There is almost exponential trend in the number of registration. It is clearly visible from the chart that the number of registration is drastically increasing for Education sector between 2000 to 2019.</p><p>Insight:</p><ul><li>There is drastic decrease in number of companies registration from 2019 to 2020 but the number of companies registration is higher in Education sector. As the demand for online classes had increased due to covid-19, this could be the reason for the same.</li></ul><h4>4. What is the status of most of the companies currently (2020) having highest Paidup capital? Which are the top 5 states having highest number of active companies?</h4><p>Let’s first add one more column in the data with the name COUNTRY to make our sunburst map more clear and effective.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D112&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D112&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/837a98fe7101f078ac6ede1254065b9c/href">https://medium.com/media/837a98fe7101f078ac6ede1254065b9c/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D113&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D113&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/927d6c964005de301b63ee2b159a405d/href">https://medium.com/media/927d6c964005de301b63ee2b159a405d/href</a></iframe><p>Let’s create a dictionary to map company status’s codes with company’s status.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D115&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D115&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/17918eb0e06f3bc7c0c361df346892ca/href">https://medium.com/media/17918eb0e06f3bc7c0c361df346892ca/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D116&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D116&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e162c979b9b06bfc481352c3a8e1477/href">https://medium.com/media/5e162c979b9b06bfc481352c3a8e1477/href</a></iframe><p>To get more visualization, we will use sunburst chart. Hover over the chart to get information from the chart. Click on any status to get more insights and then do click on it to get original visualization.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D118&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D118&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/2065828eb6a16677033f68d79a4a6495/href">https://medium.com/media/2065828eb6a16677033f68d79a4a6495/href</a></iframe><p>Hence, most of the companies are active according to highest paidup capital. The top states having highest number of active companies acccording to highest paidup capital are Maharashtra, Gujarat, Delhi, Tamil Nadu, Karnataka.</p><p>Insight:</p><ul><li>By clicking on the strike-off status, it is clear that most of the companies from West Bengal have been striked off. This could be the reason of West Bengal doesn’t hold position in top 5 states having highest number of active companies while it hold position in top 5 states having highest registration of companies.</li></ul><h4>5. Are the most companies Private or Public having highest paidup capital? Which are the top 5 states having Public companies? Which are the top 5 states having Private companies?</h4><p>We will answer this question using treemap. But to visualize this the data shouldn’t have missing values. So, to handle this we will fill missing values with `NA`.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D123&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D123&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c16cde8affe39c6498fce338eb69d30/href">https://medium.com/media/2c16cde8affe39c6498fce338eb69d30/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D124&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D124&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5ce920e51a2d5f516eb48c94a98a300/href">https://medium.com/media/e5ce920e51a2d5f516eb48c94a98a300/href</a></iframe><p>Most of the companies are Public with highest Paidup capital.</p><p>Maharashtra, Gujarat, Delhi, Uttar Pradesh, Tamil Nadu are the top 5 states having highest number of Public companies with highest Paidup capital.</p><p>Maharashtra, Delhi, Gujarat, Tamil Nadu, Karnataka are the top 5 states having highest number of Private companies with highest Paidup capital.</p><h4>6. Which are the top 5 companies according to authorized cap? Are the same companies among top 5 according to Paidup capital also?</h4><p>To answer this question first we will make two different dataframes with 5 top companies with highest authorized cap and Paidup capital respectively. Then, will visualize this.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D128&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D128&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/6fda5d08f25dc30247dab590ad179f4e/href">https://medium.com/media/6fda5d08f25dc30247dab590ad179f4e/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D129&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D129&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/61b907965924d0669c857332fa7e3e88/href">https://medium.com/media/61b907965924d0669c857332fa7e3e88/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D130&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D130&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/f5e6b4c92bf5d5c9a3256f0615a6b2c1/href">https://medium.com/media/f5e6b4c92bf5d5c9a3256f0615a6b2c1/href</a></iframe><p>Therefore, Jio Platforms Limited is the company having highest authorized cap followed by Reliance Jio infocomm Limited, U.P. Power Corporation Limited, Tata Teleservices Limited, MSEB Company Holding Limited. Not all these 5 companies among top 5 companies having highest Paidup capital except Jio Platforms Limited, Reliance Jio infocomm Limited, U.P. Power Corporation Limited and MSEB Company Holding Limited.</p><h4>7. Is there any trend monthwise registration? Which month has the highest number of registration and which month has the lowest number of registration? What can be the reason of the highest registration for the month?</h4><p>To answer this question, first we will find out number of companies registered monthly by using dt.month_name().value_counts() function from Pandas library. Then we will arrange according to month then will visulize it to get more insights.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D134&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D134&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/884158a5ff108021034ed80b59b51cb3/href">https://medium.com/media/884158a5ff108021034ed80b59b51cb3/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D135&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D135&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/50d510be0cb74617a68682057ea3d168/href">https://medium.com/media/50d510be0cb74617a68682057ea3d168/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D136&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D136&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/d135ddcfe5b07080d1eecd37c02fb90c/href">https://medium.com/media/d135ddcfe5b07080d1eecd37c02fb90c/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D137&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D137&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/3ca641a84575609c334836d46b38a98d/href">https://medium.com/media/3ca641a84575609c334836d46b38a98d/href</a></iframe><p>There is no particular trend in monthwise registration. March has the highest number of companies registration while November has the least number of companies registration. March is the last month of the financial year this could be the reason of highest registration in March.</p><h4>8. What are the top 5 business activities in Meghalaya?</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D140&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D140&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea37b4c2415b3e6841eb78bcbfc8f718/href">https://medium.com/media/ea37b4c2415b3e6841eb78bcbfc8f718/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D141&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fexploratory-data-analysis-project%2Fv%2F53%26cellId%3D141&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F0efb23c621a4430a8ba4ce861c53b9aa%2Fpreview%2F61de3fb8669c4c10a87deeacd32ff0f6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8601a1f7ca6733e4dc671544b72d8c1/href">https://medium.com/media/b8601a1f7ca6733e4dc671544b72d8c1/href</a></iframe><p>The top principal business activity in Meghalaya is Manufacturing (411) followed by Real estate renting and business activities (149), Mining and quarrying (110), Wholesale and retail trade repair of motor vechicles motorcycles and personal household goods (100), Construction (58).</p><p>Insight:</p><ul><li>For Meghalaya, Mining and quarrying hold position in top 5 business activities while the overall companies registration Mining and quarrying doesn’t hold position in top 5 principal business activities, not in top 10 also.</li></ul><h3>Summary and Conclusion</h3><ol><li>Uttar Pradesh has the highest population in India but doesn’t hold position in top 5 states having highest number of companies registered.</li><li>Approx 60% of the companies are active as of the year 2020.</li><li>Maharashtra is the leading state in terms of having highest number of registered companies as well as highest number of active companies with high Paidup capital.</li><li>Real estate and rental business activities is the growing industry.</li><li>There is drastic decrease in number of companies registration from 2019 to 2020 but the number of companies registration is higher in Education sector. As the demand for online classes had increased due to covid-19, this could be the reason for the same.</li><li>Approx 92% of the companies are Private.</li><li>The highest number of companies(128.658 k) registered in 2019.Then there is drastically decrease in number of companies registration. In March 2020, government announced the lockdown due to covid-19. This could be reason for decrease in companies registration.</li><li>West Bengal doesn’t hold position in top 5 states having highest number of active companies while it hold position in top 5 states having highest registration of companies.</li><li>For Meghalaya, Mining and quarrying hold position in top 5 business activities while the overall companies registration Mining and quarrying doesn’t hold position in top 5 principal business activities, not in top 10 also.</li></ol><h3>Future Work Ideas</h3><p>We can answer the following questions:</p><ul><li>What are the top 5 business activities in Mumbai?</li><li>What is the status of most of the companies currently (2020) having highest authorized cap? Which are the top 5 states having highest number of active companies?</li><li>What is the average Paid up capital by the companies?</li></ul><p>We can combine this data with different datasets having information like total revenue, profit, loss and other information about the company to get more insights.</p><h3>References:</h3><ul><li>Tutorial for Pandas available at <a href="https://jovian.ai/learn/zero-to-data-analyst-bootcamp/lesson/analyzing-tabular-data-with-pandas">https://jovian.ai/learn/zero-to-data-analyst-bootcamp/lesson/analyzing-tabular-data-with-pandas</a></li><li>Tutorial for Matplotlib and Seaborn available at <a href="https://jovian.ai/learn/zero-to-data-analyst-bootcamp/lesson/visualization-with-matplotlib-and-seaborn">https://jovian.ai/learn/zero-to-data-analyst-bootcamp/lesson/visualization-with-matplotlib-and-seaborn</a></li><li>Tutorial for Plotly available at <a href="https://jovian.ai/learn/zero-to-data-analyst-bootcamp/lesson/interactive-visualization-with-plotly-and-folium">https://jovian.ai/learn/zero-to-data-analyst-bootcamp/lesson/interactive-visualization-with-plotly-and-folium</a></li><li>Build an Exploratory Data Analysis Project from Scratch with Python, Numpy, and Pandas available at <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DkLDTbavcmd0%26t%3D7401s">https://www.youtube.com/watch?v=kLDTbavcmd0&amp;t=7401s</a></li><li>To change the hover data in Plotly available at <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fplotly.com%2Fpython%2Fhover-text-and-formatting%2F">https://plotly.com/python/hover-text-and-formatting/</a></li><li>Choropleth Map in Plotly available at <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fplotly.com%2Fpython%2Fmapbox-county-choropleth%2F">https://plotly.com/python/mapbox-county-choropleth/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7f042a676ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Beginner’s Guide To Use Python For Linear Algebra]]></title>
            <link>https://medium.com/@kshamasinghal/a-beginners-guide-to-use-python-for-linear-algebra-df0e25660ed?source=rss-4a27dccb1e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/df0e25660ed</guid>
            <category><![CDATA[linear-algebra]]></category>
            <category><![CDATA[numpy]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Kshama Singhal]]></dc:creator>
            <pubDate>Sat, 20 Aug 2022 13:49:58 GMT</pubDate>
            <atom:updated>2022-08-23T06:38:12.130Z</atom:updated>
            <content:encoded><![CDATA[<h4>Data Science</h4><h4>Five Must Know Numpy Functions</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z9VZpNRpJJY18-56" /><figcaption>Photo by <a href="https://unsplash.com/@rubaitulazad?utm_source=medium&amp;utm_medium=referral">Rubaitul Azad</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><pre><strong>Index Of Contents</strong><br>· <a href="#6f04">Introduction</a><br>· <a href="#e078">Function 1 - np.linalg.det</a><br>· <a href="#374b">Function 2 — np.linalg.matmul</a><br>· <a href="#5204">Function 3 — np.linalg.eigvals</a><br>· <a href="#31b9">Function 4 — np.linalg.inv</a><br>· <a href="#ff3c">Function 5 — np.linalg.solve</a><br>· <a href="#f61b">Conclusion</a><br>· <a href="#ea32">Reference Links</a></pre><h3>Introduction</h3><p>We are going to use the Numpy library of Python. Numpy is the fundamental package for scientific/numerical computing in Python. It provides different data structures, functions, and tools for numerical computing in Python. We are going to learn about these given below functions with working examples (useful in linear algebra):</p><ul><li>det</li><li>matmul</li><li>eigvals</li><li>inv</li><li>solve</li></ul><p>Let’s begin by importing Numpy as np and listing out the functions covered in this blog.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D5&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D5&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/642486ac4b8e9c3a79001616cc3e66c0/href">https://medium.com/media/642486ac4b8e9c3a79001616cc3e66c0/href</a></iframe><p>To make it easy to call Numpy we are aliasing Numpy as np.</p><p>linalg module contains all the necessary functions of linear algebra, so we have to call functions as np.linalg.fun_name.</p><h3>Function 1 — np.linalg.det</h3><p><strong>Question</strong>: What is area of the triangle having vertices P(4,2), Q(8,4) and R(5,6)?</p><p>We are going to use the given formula to calculate the area of the triangle. To calculate the determinant of the matrix, we will use np.linalg.det function of numpy library.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D9&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D9&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/45b2d863c91e4cdcdf5ed39d2fb4d132/href">https://medium.com/media/45b2d863c91e4cdcdf5ed39d2fb4d132/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D10&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D10&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/53d1b2ffebeeea0ad05c6793ca260db0/href">https://medium.com/media/53d1b2ffebeeea0ad05c6793ca260db0/href</a></iframe><p>Hence, the area is approximately 7 𝑠𝑞.𝑢𝑛𝑖𝑡𝑠.</p><p><strong>Question</strong>: What is the determinant of the matrix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/109/1*2rKeaHdIxQ37vPlc8BjHMA.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D13&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D13&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/de3c15b4429a61c3ee23f43f7fd46b7d/href">https://medium.com/media/de3c15b4429a61c3ee23f43f7fd46b7d/href</a></iframe><p>To find out the determinant of the above matrix we have used np.linalg.det function from Numpy library as it is same as determinant in Mathematics. Instead of doing it manually this function make it easy to find the determinant. Hence, the determinant is approximately −270.</p><p><strong>Question</strong>: Can you find out the determinant of the matrix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/100/1*4CTzH1wJKilL4T4z-68nLA.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D16&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D16&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b641372356b71df33c0c17e21e18922c/href">https://medium.com/media/b641372356b71df33c0c17e21e18922c/href</a></iframe><p>This is breaking because it is possible to find out the determinant of a square matrix only.</p><p>Use np.linalg.det to find out determinant of square matrices only.</p><h3>Function 2 — np.linalg.matmul</h3><p><strong>Question</strong> What is matrix multiplication of</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/322/1*bT8O2nePW-TdjUo6Shu8ag.png" /></figure><p>We will use np.linalg.matmul function to do matrix multiplication it is similar to matrix multiplication in linear algebra.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D21&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D21&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f8b0e983414377177e6120b3e788ebe/href">https://medium.com/media/9f8b0e983414377177e6120b3e788ebe/href</a></iframe><p>The above code is giving numpy array as the output, in numpy, array means N dimensional array while matrix is a 2 dimensional array. So, Matrix is a subset of numpy arrays.</p><p><strong>Question</strong> What is matrix multiplication of</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*v43Y4GY_arkNN6RyZSdHbA.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D24&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D24&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/7957fbb0e9df83aac675d6bf70b6cbe9/href">https://medium.com/media/7957fbb0e9df83aac675d6bf70b6cbe9/href</a></iframe><p><strong>Question</strong> What is matrix multiplication of</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/1*xoqV7EznUDYGNiGOX6Vsjw.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D26&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D26&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/692749a4ef704cce7358ff5c7a7b0196/href">https://medium.com/media/692749a4ef704cce7358ff5c7a7b0196/href</a></iframe><p>The above code is breaking as it is violating the matrix multiplication condition.</p><p><em>Condition</em>: We can find out A×B where matrix A have size m×n and B have size x×y only if n=x.</p><p>Keep in mind the above condition at the time of using np.linalg.matmul function.</p><h3>Function 3 — np.linalg.eigvals</h3><p><strong>Question</strong> What are the eigenvalues for the matrix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/88/1*OnsRUdZuu0QHwdnFimd85g.png" /></figure><p>To find out eigenvalues we will use np.linalg.eigvals function of numpy.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D31&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D31&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/ae867d14a3d07d68c5df0c17a2613191/href">https://medium.com/media/ae867d14a3d07d68c5df0c17a2613191/href</a></iframe><p>As the above is a 2×2 matrix so the output is an array containing 2 eigenvalues.</p><p><strong>Question</strong> What are the eigenvalues for the matrix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/116/1*Aov9gqNlgxwXIoRcmlxNTQ.png" /></figure><p>To find out the eigenvalues for a given matrix use np.linalg.eigvals function.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D33&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D33&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/c25bef58d7f0d8b39a24c8b447d162ae/href">https://medium.com/media/c25bef58d7f0d8b39a24c8b447d162ae/href</a></iframe><p>As the above is a 3×3 matrix so the output is an array containing 3 eigenvalues.</p><p><strong>Question</strong> What are the eigenvalues for the matrix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/118/1*5yK4Gz5jNaX13tPzyLqnWA.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D36&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D36&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa870a0548df0ff5f7860f9b79df5ff3/href">https://medium.com/media/aa870a0548df0ff5f7860f9b79df5ff3/href</a></iframe><p>According to linear Algebra, we can find out eigenvalues for square matrices only that’s why the above code is breaking as the above matrix is not a square matrix.</p><p>Keep in mind that the matrix should be square at the time of using np.linalg.eigvals.</p><h3>Function 4 — np.linalg.inv</h3><p><strong>Question</strong> What will be the inverse for the matrix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/116/1*Aov9gqNlgxwXIoRcmlxNTQ.png" /></figure><p>To find the inverse of a matrix we will use np.linalg.inv function of numpy.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D41&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D41&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/f063fbca95650eb4a73c3bd918c50f7f/href">https://medium.com/media/f063fbca95650eb4a73c3bd918c50f7f/href</a></iframe><p><strong>Question</strong> What will be the inverse for the matrix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/84/1*yJ5g9Ym85B296B0WYQxB8w.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D43&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D43&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/03b7f2e6fd54bd6752191f75582e9878/href">https://medium.com/media/03b7f2e6fd54bd6752191f75582e9878/href</a></iframe><p><strong>Question</strong> What will be the inverse for the matrix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/103/1*9eYGYiWI-aRxy2Tkq95r0g.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D46&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D46&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5b0eaabebb142861f80a99e9a5c031e/href">https://medium.com/media/e5b0eaabebb142861f80a99e9a5c031e/href</a></iframe><p>According to linear Algebra we can find out inverse for square matrices only that’s why the above code is breaking as the above matrix is not a square matrix.</p><p>Keep in mind that the matrix should be square at the time of using np.linalg.inv</p><h3>Function 5 — np.linalg.solve</h3><p><strong>Question</strong> Solve the system of equations x+2y=1 and 3x+5y=2.</p><p>To solve the linear system of equations we will use np.linalg.solve function of numpy which takes two matrices as input.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D51&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D51&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/c49503ebb1c744e7ae152e71f14e46f8/href">https://medium.com/media/c49503ebb1c744e7ae152e71f14e46f8/href</a></iframe><p>Hence, the solution of x is −1 and y is 1.</p><p><strong>Question</strong> Solve the system of equations x+2y+3z=4, 3x+5y+7z=8 and 4x+9y+8z=10.</p><p>First we will define two matrices a and b, then use np.linalg.solve function of numpy.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D54&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D54&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/c245d825348e778aa9f645e507694975/href">https://medium.com/media/c245d825348e778aa9f645e507694975/href</a></iframe><p>Hence, the solution of x is 2.33, y is 0.67 and z is 1.67 after rounding off to two digits.</p><p><strong>Question</strong> Solve the system of equations x+2y+3z+4w=4 and 3x+5y+7z+9w=8 and 4x+9y+8z+8w=10.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D57&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fzerotoanalyst-numpy-array-operations%2Fv%2F23%26cellId%3D57&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2Fe0fe91ddb7174cd1811a88eeda9b238c%2Fpreview%2Ffe50576552b94ce5a062f689cc68fcca&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/03685471fa4c7470b3fcb41cec5bb1c8/href">https://medium.com/media/03685471fa4c7470b3fcb41cec5bb1c8/href</a></iframe><p>The above code is breaking because a matrix is not a square matrix.</p><p>a must be square and of full-rank, i.e., all rows (or, equivalently, columns) must be linearly independent; if either is not true, use lstsq for the least-squares best “solution” of the system/equation.</p><h3>Conclusion</h3><p>We have learnt about these given below functions with working examples (useful in linear algebra):</p><ul><li>det</li><li>matmul</li><li>eigvals</li><li>inv</li><li>solve</li></ul><p>These were basic functions helpful in linear algebra. If you want to go advance, there are some functions which will be good to know:</p><ul><li>svd (use for singular value decomposition)</li><li>eigval (use to find out eigenvalues and eigenvectors)</li><li>norm (use to find norm) and many more.</li></ul><p>Check out <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fnumpy.org%2Fdoc%2Fstable%2Freference%2Froutines.linalg.html">this</a> to know more functions.</p><h3>Reference Links</h3><p>These are the links to your references :</p><ul><li>Numpy official tutorial : <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fnumpy.org%2Fdoc%2Fstable%2Fuser%2Fquickstart.html">https://numpy.org/doc/stable/user/quickstart.html</a></li><li>Numpy Linear Algebra official: <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fnumpy.org%2Fdoc%2Fstable%2Freference%2Froutines.linalg.html">https://numpy.org/doc/stable/reference/routines.linalg.html</a></li></ul><p>Please feel free to give feedback.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df0e25660ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scraping ‘Quotes to Scrape’ website using Python]]></title>
            <link>https://medium.com/@kshamasinghal/scraping-quotes-to-scrape-website-using-python-c8a616b244e7?source=rss-4a27dccb1e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8a616b244e7</guid>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[beautifulsoup]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Kshama Singhal]]></dc:creator>
            <pubDate>Sun, 10 Jul 2022 16:19:30 GMT</pubDate>
            <atom:updated>2022-10-07T08:52:57.764Z</atom:updated>
            <content:encoded><![CDATA[<h4>Data Science</h4><h3>Scraping ‘Quotes to Scrape’ Website Using Python</h3><h4>Using requests, beautiful soup, and pandas</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SI2hxIzRkSoPnyqM" /><figcaption>Photo by <a href="https://unsplash.com/@anagani_saikiran?utm_source=medium&amp;utm_medium=referral">Sai Kiran Anagani</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><pre><strong>Index Of Contents</strong><br>· <a href="#666f">What is Web Scraping?</a><br>· <a href="#eb6d">Steps to Follow</a><br>· <a href="#a55e">Install and Import important libraries</a><br>· <a href="#817d">Download the web page Quotes To Scrape using requests library</a><br>· <a href="#7b87">Inspect HTML of the web page</a><br>· <a href="#6a86">Parsing parts of the website using Beautiful Soup</a><br>· <a href="#bed3">Convert parsing parts into csv file</a><br>· <a href="#6132">Have a look on csv file using pandas library</a><br>· <a href="#9a4d">Summary</a><br>· <a href="#4a10">Future works ideas</a><br>· <a href="#ac2c">References</a></pre><p>Quotes to Scrape is the website for popular quotes by different authors related to different subjects. Who doesn’t like to hear quotes? Everyone likes to hear quotes as we can connect with our feelings like feelings of fear, sadness, motivation, science, art, etc.</p><p>We will use this <a href="https://quotes.toscrape.com/">http://quotes.toscrape.com/ </a>page to retrieve the information using web scraping. In this project, we are going to scrape quotes with their authors, tags (subjects), and links to the author’s biography.</p><h4>What is Web Scraping?</h4><p>Web Scraping is the process of extracting and parsing data from websites in an automated fashion using a computer program. There are many examples where web scraping can be useful, e.g. to create a job searching scraper, top movies scraper, a mobile phone’s price scraper, and so on. For example, here we are extracting quotes. Web scraping involves extracting information often from HTML documents and then convert into structured data like <a href="https://support.google.com/google-ads/answer/9004364?hl=en#:~:text=A%20CSV%20(comma%2Dseparated%20values,in%20a%20table%20structured%20format.">CSV</a> files.</p><h3>Steps to Follow :</h3><ul><li>Install important libraries that will be helpful for the project i.e. <a href="https://requests.readthedocs.io/en/latest/">requests</a>, <a href="https://pypi.org/project/beautifulsoup4/">BeautifulSoup4</a>, <a href="https://pandas.pydata.org/docs/">pandas</a>.</li><li>Download the web page using the requests library</li><li>Inspecting <a href="https://www.w3schools.com/html/">HTML</a> source code of the web page</li><li>Parsing parts of the website using Beautiful Soup</li><li>Convert parsing parts into csv file</li><li>Have a look on csv file using pandas library</li></ul><h3>Install and Import important libraries</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F87%26cellId%3D2&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F87%26cellId%3D2&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2Fb38cf426f3d8412d9a1f64afa4c6f9fa&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e85bfe45d2f67bc12558d12c7b9b3f3/href">https://medium.com/media/8e85bfe45d2f67bc12558d12c7b9b3f3/href</a></iframe><h3>Download the web page Quotes To Scrape using requests library</h3><p>Requests is elegant and simple HTTP (Hyper Text Transfer Protocol) library for Python which allows you to send HTTP requests easily. Requests.get function will download the web page and returns a response object with page contents and some information indicating whether the request was successful, using a status_code.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F87%26cellId%3D4&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F87%26cellId%3D4&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2Fb38cf426f3d8412d9a1f64afa4c6f9fa&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f7073673c503d0a5b095ae934a01332/href">https://medium.com/media/1f7073673c503d0a5b095ae934a01332/href</a></iframe><p>response.status_code will provide you the code whether the request was successful or not. If the status.code lies between 200 to 209 then the request was successful otherwise it was not successful.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F87%26cellId%3D6&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F87%26cellId%3D6&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2Fb38cf426f3d8412d9a1f64afa4c6f9fa&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b6d5533e9bdc3a53860565ad97b7bad/href">https://medium.com/media/8b6d5533e9bdc3a53860565ad97b7bad/href</a></iframe><h3>Inspect HTML of the web page</h3><p>We can view the source code of the webpage by doing right-clicking anywhere on the web page and selecting ‘Inspect’ option. It opens the “Developer Tools” pane, where we can see the source code as a tree. We can expand and collapse various nodes and find the source code for a specific portion of the page.</p><p>Here’s how our web page look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iV3bGMKx1QIdhPjV.png" /></figure><h3>Parsing parts of the website using Beautiful Soup</h3><p>To extract information from the HTML source code using programming, we will use the <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fwww.crummy.com%2Fsoftware%2FBeautifulSoup%2Fbs4%2Fdoc%2F">Beautiful Soup</a> library. Beautiful Soup will return an object containing several properties and methods to extract the information from HTML documents.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F87%26cellId%3D9&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F87%26cellId%3D9&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2Fb38cf426f3d8412d9a1f64afa4c6f9fa&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/8be6199cd10c3de9c878aa3b7a3a2cb7/href">https://medium.com/media/8be6199cd10c3de9c878aa3b7a3a2cb7/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/0*CI4_wFN4jZLprqb2.png" /></figure><p>Upon inspecting the box containing information for the quotes, we will find a div tag for every quote, with class set to quote.</p><p>Let’s find all the div tags having class quote.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F87%26cellId%3D11&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F87%26cellId%3D11&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2Fb38cf426f3d8412d9a1f64afa4c6f9fa&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/c205e961318bcb208ad722387fe8bc35/href">https://medium.com/media/c205e961318bcb208ad722387fe8bc35/href</a></iframe><p>Every page has 10 quotes, hence the length of div_tags is 10. div_tags contains the information such as <strong>quote, author name, links to author&#39;s biography, tags</strong>.</p><p>Let’s extract quotes using the helper function get_quotes .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/0*MezBLdIdCGBo59AY.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D14&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D14&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2F449505b39e24418ea68bc7dc4ba8e157&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/edfd85334eca5bd327f29828bfa29a59/href">https://medium.com/media/edfd85334eca5bd327f29828bfa29a59/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D15&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D15&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2F449505b39e24418ea68bc7dc4ba8e157&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f0291457e576d47e80896c687758888/href">https://medium.com/media/9f0291457e576d47e80896c687758888/href</a></iframe><p>Let’s extract author names, which is inside small tag with class set to author which is inside span tag with class set to None, using the helper function get_author_name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*qu3X7XpQyi5D6_9piw9xZg.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D17&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D17&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2F449505b39e24418ea68bc7dc4ba8e157&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/da8401f811538d415749f8e34a5aed60/href">https://medium.com/media/da8401f811538d415749f8e34a5aed60/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D18&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D18&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2F449505b39e24418ea68bc7dc4ba8e157&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/67cb69d315f0f3ad6a252cdf5dd0d7ff/href">https://medium.com/media/67cb69d315f0f3ad6a252cdf5dd0d7ff/href</a></iframe><p>Let’s extract tags of the quotes, which is inside meta tag with attribute content which is inside div tag with class set to tags, using the function get_quote_tag .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*XAUgBtjHWnyFRNPugoZJDQ.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D23&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D23&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2F449505b39e24418ea68bc7dc4ba8e157&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/ee3e5816fb29b80d37375f7be41079c4/href">https://medium.com/media/ee3e5816fb29b80d37375f7be41079c4/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D24&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D24&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2F449505b39e24418ea68bc7dc4ba8e157&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b06e3e25d1d502a977a0b05312a45289/href">https://medium.com/media/b06e3e25d1d502a977a0b05312a45289/href</a></iframe><p>Let’s extract author’s biography links, which is inside a tag with attribute href which is inside span tag with class set to None, using the function get_author_links.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*SJ6B3nGZxhMwvSBKEYCnIg.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D20&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D20&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2F449505b39e24418ea68bc7dc4ba8e157&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ccd420194fac42758e8f26a09549d78/href">https://medium.com/media/5ccd420194fac42758e8f26a09549d78/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D21&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D21&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2F449505b39e24418ea68bc7dc4ba8e157&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/92ca5e8df6bd29db445adbf221edab36/href">https://medium.com/media/92ca5e8df6bd29db445adbf221edab36/href</a></iframe><p>We will make the list of dictionaries by combining all the lists obtained by parsing the website using Beautiful Soup.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D26&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D26&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2F449505b39e24418ea68bc7dc4ba8e157&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/8842db9c94ae9c58999235f3280ee278/href">https://medium.com/media/8842db9c94ae9c58999235f3280ee278/href</a></iframe><h3>Convert Parsing Parts into CSV File</h3><p>Let’s first convert dictionary into Pandas <a href="https://pandas.pydata.org/docs/user_guide/dsintro.html#:~:text=to%20different%20objects.-,DataFrame,most%20commonly%20used%20pandas%20object.">DataFrame</a>. A Pandas DataFrame is a 2 dimensional data structure, like a 2 dimensional array, or a table with rows and columns. Then, using to_csv, will save the DataFrame into CSV file.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D28&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D28&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2F449505b39e24418ea68bc7dc4ba8e157&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f77bd5dabbbfdbd26ee79fbe6658041/href">https://medium.com/media/0f77bd5dabbbfdbd26ee79fbe6658041/href</a></iframe><h3>Have a Look on CSV File Using Pandas Library</h3><p>read_csv helps to read a comma-separated values (csv) file into DataFrame.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F86%26cellId%3D26&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F86%26cellId%3D26&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2F6da32a2ebf38401da9602869e613d3b4&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/a291d02e0f1de689624c272e537df15a/href">https://medium.com/media/a291d02e0f1de689624c272e537df15a/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D34&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Fsinghalkshama4343%2Fweb-scraping-project%2Fv%2F88%26cellId%3D34&amp;image=https%3A%2F%2Fapi.jovian.ai%2Fapi%2Fgist%2F88955ecee0f842c09b6c8bf651869dac%2Fpreview%2F449505b39e24418ea68bc7dc4ba8e157&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/53df2d5d08f502c75c9b6e64af5400d2/href">https://medium.com/media/53df2d5d08f502c75c9b6e64af5400d2/href</a></iframe><p>For full code <a href="https://jovian.ai/singhalkshama4343/web-scraping-project">check</a> this.</p><h3>Summary</h3><ul><li>Downloaded the webpage using requests library</li><li>Find the list of quotes, author names, urls, quote tags for the single page by parsing the HTML source code of the web page using the Beautiful Soup library</li><li>Combined the lists of all the required pages</li><li>Convert those lists into list of dictionaries</li><li>Convert the parsed information into CSV file</li><li>Had a look on CSV file using Pandas library</li></ul><h3>Future works ideas</h3><ul><li>We can scrape the web page for the pages individually</li><li>We can do analysis for finding the top 10 authors</li><li>We can do analysis for finding the top 10 tags</li></ul><h3>References</h3><ul><li>N S, Aakash. (2021) “Let’s Build a Python Web Scraping Project from Scratch”, <a href="https://jovian.ai/outlink?url=http%3A%2F%2FJovian.ai">Jovian.ai</a>, Available at :<a href="https://jovian.ai/outlink?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DRKsLLG-bzEY">https://www.youtube.com/watch?v=RKsLLG-bzEY</a></li><li>Requests Documentation, available at <a href="https://jovian.ai/outlink?url=https%3A%2F%2Frequests.readthedocs.io%2Fen%2Flatest%2F">https://requests.readthedocs.io/en/latest/</a></li><li>BeautifulSoup Documentation, available at <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fwww.crummy.com%2Fsoftware%2FBeautifulSoup%2Fbs4%2Fdoc%2F">https://www.crummy.com/software/BeautifulSoup/bs4/doc/</a></li><li>Pandas Dataframe as a CSV, available at <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fwww.geeksforgeeks.org%2Fsaving-a-pandas-dataframe-as-a-csv%2F">https://www.geeksforgeeks.org/saving-a-pandas-dataframe-as-a-csv/</a></li><li>Quotes To Scrape Website, available at <a href="https://jovian.ai/outlink?url=https%3A%2F%2Fquotes.toscrape.com%2F">https://quotes.toscrape.com/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8a616b244e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>