<?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 Ektamanvar on Medium]]></title>
        <description><![CDATA[Stories by Ektamanvar on Medium]]></description>
        <link>https://medium.com/@ektamanvar23?source=rss-d993e54b6a45------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5ygNrFNpPFPGgjwYJynRRw.jpeg</url>
            <title>Stories by Ektamanvar on Medium</title>
            <link>https://medium.com/@ektamanvar23?source=rss-d993e54b6a45------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 18:12:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ektamanvar23/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[Basic SQL Techniques For Data Analysis]]></title>
            <link>https://medium.com/analytics-vidhya/sql-techniques-for-data-analysis-92d85de3c32a?source=rss-d993e54b6a45------2</link>
            <guid isPermaLink="false">https://medium.com/p/92d85de3c32a</guid>
            <category><![CDATA[relational-databases]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Ektamanvar]]></dc:creator>
            <pubDate>Wed, 02 Mar 2022 22:11:53 GMT</pubDate>
            <atom:updated>2022-03-10T17:42:28.171Z</atom:updated>
            <content:encoded><![CDATA[<h4>You will learn common SQL commands</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CKZ02LObPWUjfq-I" /><figcaption>Photo by <a href="https://unsplash.com/@ikukevk?utm_source=medium&amp;utm_medium=referral">Kevin Ku</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>What you will learn from this post:</strong></p><ol><li>Introduction to Relational Database &amp; SQL (Structured Query Language)</li><li>SQL Queries With Examples</li></ol><blockquote><strong>Introduction to Relational Database &amp; SQL:</strong></blockquote><p>The relational database is a type of database. It is a <strong>collection of tables</strong> with a predefined relationship between them. The relational database is compact, well structured, and efficient.</p><p>A relational management platform that allows you to manage the relational databases is called a <strong>relational database management system(RDBMS)</strong>. Some examples of relational database management systems are MySQL, Oracle DB, Microsoft SQL Server, PostgreSQL.</p><h3>SQL is the structured query language specially used to define, manage, manipulate, or retrieve the data inside the relational database management system(RDBMS).</h3><p>Before going into examples download the sample database from this <a href="https://www.mysqltutorial.org/mysql-sample-database.aspx">website</a>. Open the file in <strong>MySQL Workbench</strong> and execute the code. Under schemas, you will see the new schema classicmodels.</p><blockquote><strong>SQL Queries With Examples:</strong></blockquote><p><strong>1.SQL Select &amp; From: </strong>Used to retrieve data from the table, SELECT indicates which columns you want to view and FROM indicates from which table.</p><pre><strong>#SQL select &amp; From statement examples</strong></pre><pre>1. SELECT * FROM employees;<br>   #returns all data from employees table</pre><pre>2. SELECT firstName, lastName FROM employees;<br>   #returns particular columns</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*WCJyZWGOTZ3YK5QrlUnr0Q.jpeg" /></figure><p><strong>2. Distinct: </strong>Distinct allows you to view the unique values in a column. One or more columns can be used in the expression.</p><pre><strong>#SQL distinct clause examples</strong></pre><pre>1. SELECT distinct paymentDate FROM payments;<br>   #returns unique paymentdates</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*YoWBMM4t9f3sLaC8cllhhA.jpeg" /></figure><p><strong>3. SQL Where: </strong>This allows you to<strong> </strong>specify conditions while retrieving data from the table. To specify conditions you need to use <strong>comparison or logical operators</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QcV57jmaVF3wMsz6KRSkiA.png" /></figure><pre><strong>#SQL where clause examples</strong></pre><pre>1. SELECT * FROM customers WHERE city=&quot;NYC&quot;;<br>   #returns customers data who belongs to NYC city</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*6fF223E6ubFbHrv_z88QcA.jpeg" /><figcaption>where — equal operator</figcaption></figure><pre>2. SELECT * FROM employees WHERE firstName=&quot;Mary&quot; AND <br>   jobTitle=&quot;VP Sales&quot;;<br>   #returns employee data (two conditions should satisfy)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*NnXJYmQyp8rqge04yyY0GQ.jpeg" /><figcaption>where — AND operator</figcaption></figure><pre>3. SELECT * FROM products WHERE quantityInStock&gt;5000;<br>   #returns products info whose quantity is greater than 5000</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*rI5tMJkmXrJftcePsosxWA.jpeg" /><figcaption>where — greater than operator</figcaption></figure><pre>4. SELECT * FROM products WHERE productLine LIKE &#39;%Cars&#39;;<br>   #returns products info whose productline ends with Cars</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*deVmZzWqs7VmYuZm_B7PEw.jpeg" /><figcaption>where — LIKE operator</figcaption></figure><pre>5. SELECT * FROM offices WHERE city IN(&#39;London&#39;,&#39;Sydney&#39;,&#39;Tokyo&#39;);<br>   #returns office address for three cities</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*6E_D2kQRzdE_h435kQvYvg.jpeg" /><figcaption>where — IN operator</figcaption></figure><pre>6. SELECT * FROM payments WHERE amount BETWEEN 6000 AND 9000;<br>   #returns payment information between 6000 to 9000, includes the<br>   intervals</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*6P33tTnYF-OeU7Q-smVe9A.jpeg" /><figcaption>where — BETWEEN operator</figcaption></figure><pre>7. SELECT * FROM customers WHERE NOT city=&#39;Singapore&#39;;<br>   #returns customer information except for city Singapore</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*GfCj6AXVtRvw7ydOuF8ilw.jpeg" /><figcaption>where — NOT operator</figcaption></figure><pre>8. SELECT * FROM orders WHERE comments IS NULL;<br>   #returns order info(comment column is null)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*jFZZf-2qmIwVzAEUTknuGg.jpeg" /><figcaption>where — NULL operator</figcaption></figure><p><strong>4.SQL Aggregation: </strong>Aggregate functions<strong> </strong>aggregate across the <strong>entire column</strong>. You will use the aggregate functions all the time.</p><p><strong>Min, Max, Count</strong> functions can be used with numerical and non-numerical columns and whereas <strong>sum, avg</strong> functions are used with numerical columns only.</p><ul><li>COUNT: returns the total number of rows</li><li>SUM: returns the sum of all the values</li><li>MAX: returns the maximum value</li><li>MIN: returns the minimum value</li><li>AVG: returns the average value</li></ul><pre><strong>#SQL aggregate functions examples</strong></pre><pre>1. SELECT COUNT(*) FROM employees; <br>   #returns total number of rows (non null + null values)</pre><pre>2. SELECT COUNT(customerName) FROM customers;<br>   #counts particular column rows(only non null values)</pre><pre>3. SELECT MAX(amount), MIN(amount), SUM(amount) FROM payments;<br>   #returns maximum, minimum and total payment amount</pre><pre>4. SELECT MAX(firstName) FROM employees;<br>   #firstname is non numerical column so returns as close <br>   alphabetically to &quot;Y&quot; as possible because of MAX function</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*SWDuQr26s_Rp-2CU5RBmjQ.jpeg" /></figure><p>5. <strong>AS (Alias):</strong> This allows you to rename a column or table. Note that it won’t alter the names in their original columns or tables.</p><pre><strong>#SQL Alias examples</strong></pre><pre>SELECT MAX(amount) AS max_amount, MIN(amount) AS min_amount, SUM(amount) AS total_amount FROM payments;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*aStYVrf450ti3Pi_XaY9Kw.jpeg" /></figure><p><strong>6.SQL Group By: </strong>group by clause allows you to separate data into groups, which can be aggregated independently of one another.</p><p>You can group by multiple columns, but you have to separate column names with commas same as order by clause.</p><pre><strong>#SQL group by</strong></pre><pre>SELECT productline, sum(quantityInStock) FROM products group by productline;<br>#data is divided into groups (In our case it is productline) and then aggregates each group independently based on aggregation function you specified.</pre><pre>See the below image to see how the groupby works</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*B5bsyqiYjSGdkBVmysaU_g.jpeg" /></figure><p><strong>7.SQL Having: </strong>Having clause allows you to filter the data that has been aggregated. In where clause you cannot specify aggregate functions but in having clause you can specify aggregate functions.</p><p>Most of the time Having clause is used with the group by clause. Having can be used without group by clause, in an aggregate function, in that case it behaves like where clause.</p><pre><strong>#SQL Having</strong></pre><pre>SELECT  productline, sum(quantityInStock) FROM products group by productline having sum(quantityInStock)&gt;60000;<br>#Grouped data is filtered using having clause</pre><pre>See the below image to see how the having clause works</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*bwFwn5tEo3pXUVSRjqGICw.jpeg" /></figure><p><strong>8.SQL Order By: </strong>Order by clause allows you to reorder your results in ascending or descending order based on the data in one or more columns. <strong>By default orders in ascending order</strong></p><pre><strong>#SQL order by</strong></pre><pre>1. SELECT * FROM payments ORDER BY amount;<br>   #sorts result in ascending order</pre><pre>2. SELECT * FROM offices ORDER BY City Desc;<br>   #sorts result in descending order by desc keyword</pre><pre>3. SELECT * FROM employees ORDER BY firstName, employeeNumber desc;<br>   #first sorts the result by firstName in ascending order (A to Z) and then by employeeNumber in descending order within those already sorted records</pre><pre>To understand sorting data by two columns(3rd example), see below image.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*MKWlODAafdYkRFEjVIoo4w.jpeg" /></figure><p><strong>9. SQL Limit: </strong>Limit allows you to specify the number of records to return</p><pre><strong>#SQL limit</strong></pre><pre>SELECT * from orders limit 5;<br>#returns first 5 records</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*8QIFh-E8AHHlYg5REqoDSg.jpeg" /></figure><p><strong>10. Joins: </strong>Before we discuss the concept of joins, I think it is important that we first distinguish the difference between a primary key and a foreign key.</p><p>The primary key is a unique identifier of the table. It must contain unique values and cannot have null values. Each table can have only one primary key. The table containing the primary key is called the parent table.</p><p>The foreign key is used to link two tables together. It is a column in one table that refers to the primary key in another table. Each table can have multiple foreign keys. The table containing the foreign key is called the child table.</p><h3>Joins is used to combine rows from two or more tables based on the related column between them (Primary key and Foreign key)</h3><p><strong>Types of joins:</strong></p><ul><li>Inner Join: Returns records that have matching values in both tables</li><li>Left Join: Returns all records from the left table, and the matched records from the right table</li><li>Right Join: Returns all records from the right table, and the matched records from the left table</li><li>Outer Join: Returns all records when there is a match in either left or right table</li></ul><h3><strong>The most common type of join is left join</strong></h3><p>customerNumber in the customers table is a primary key and customerNumber in the orders table is a foreign key. (See ER diagram <a href="https://www.mysqltutorial.org/wp-content/uploads/2009/12/MySQL-Sample-Database-Schema.png">here</a>)</p><pre>SELECT c.customerName, c.phone, c.city, o.orderDate, o.status <br>FROM customers AS c<br>LEFT JOIN <br>orders AS o<br>ON c.customerNumber = o.customerNumber;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*9ak-JWyKDpFeLED_txXzTQ.jpeg" /><figcaption>SQL Joins</figcaption></figure><p>Let me wrap up the select command with the full syntax. The below sequence is important while writing queries.</p><pre>#<strong>Syntax<br></strong>SELECT column1, column2 .... column(n)<br>FROM table_name<br>WHERE condition1, condition2 .... condition(n)<br>GROUP BY column1, column2 .... column(n)<br>HAVING condition1, condition2 .... condition(n)<br>ORDER BY column1, column2 .... column(n)<br>LIMIT number;</pre><pre>#<strong>example<br></strong>SELECT productLine, sum(QuantityInStock)<br>FROM products<br>WHERE buyPrice&gt;50<br>GROUP BY productLine<br>HAVING sum(QuantityInStock)&gt;50000</pre><h4>To download the SQL script follow this <a href="https://github.com/Ekta-Manvar/Basic-SQL-For-DataAnalysis">link</a></h4><p>SQL techniques learned through this post are slicing, sorting, grouping, filtering, counting, unique, aggregating data. All these techniques are useful while performing data analysis.</p><p>I hope you have gained a better understanding of what SQL is, its significance in data analytics but more importantly, realize that it is actually relatively easy to learn once you get hold of the fundamentals.</p><p>Until my next article, feel free to check out my other content here.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92d85de3c32a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/sql-techniques-for-data-analysis-92d85de3c32a">Basic SQL Techniques For Data Analysis</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Excel, Meet PivotTables]]></title>
            <link>https://medium.com/analytics-vidhya/excel-meet-pivottables-547b78faaa20?source=rss-d993e54b6a45------2</link>
            <guid isPermaLink="false">https://medium.com/p/547b78faaa20</guid>
            <category><![CDATA[pivot-tables]]></category>
            <category><![CDATA[pivot-table-data-analysis]]></category>
            <category><![CDATA[excel-pivottable]]></category>
            <category><![CDATA[excel]]></category>
            <dc:creator><![CDATA[Ektamanvar]]></dc:creator>
            <pubDate>Tue, 03 Aug 2021 20:25:34 GMT</pubDate>
            <atom:updated>2021-08-04T16:35:51.186Z</atom:updated>
            <content:encoded><![CDATA[<h4>Powerful Tool allows to <strong>calculate</strong>, <strong>summarise, &amp; analyze </strong>the data</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Vc0aHhgLA0ns1eCwArw4w.jpeg" /><figcaption>Image By Author</figcaption></figure><p>A PivotTable is powerful tool to <strong>calculate</strong>, <strong>summarise, and analyze </strong>the data stored in a table that let’s you see comparison, patterns and trends in the data.</p><p>Let’s say you are a data analyst in ABC company, the manager comes to you with questions to find out answers from sales data. So as a data analyst your responsibility is to clean data first then summarize the data by using a pivot table.</p><p>I will be explaining all the features of PivotTable by video examples. In each example, you will learn a new concept. so makesure to keep attention throughout the post. Link to the <a href="https://community.tableau.com/s/question/0D54T00000CWeX8SAL/sample-superstore-sales-excelxls">dataset</a> used in the post.</p><p>So let&#39;s begin………………</p><h3>1) What is the total sales generated by the company in each category</h3><p>Select the table that you want to summarize, then go to the <strong>INSERT </strong>tab, click on the <strong>Pivot Table </strong>it will popup display “<em>Create PivotTable</em>” click ok.</p><p>Now on the right-hand side, there is the “<em>PivotTables Fields</em>” area drag the <strong>sales, category</strong> columns in the <strong>Values, Rows </strong>sections.</p><p>You can change the number format, right-click on any number and select the <strong>Number Format </strong>option<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PtNqiNOBdpBSnMTBKuGgxw.gif" /><figcaption>Video By Author: Example 1-Pivot Table(<strong>Number Format</strong>)</figcaption></figure><h3><strong>2) What is the highest(Max) sale in each category</strong></h3><p>Create a Pivot Table by using <strong>sales, category</strong> columns. By default, data is summarized as a <strong>sum </strong>(Refer Example1).</p><p>Now right-click on any number in the Pivot Table. Select <strong>Summarize Values By</strong> and select the <strong>Max </strong>option to find out the highest sale.</p><p>You can summarize values by Min, Count, Average and lot more options available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ie9_8FYtSBfl7evzK0uFw.gif" /><figcaption>Video By Author: Example 2-Pivot Table(<strong>Summarize Values By)</strong></figcaption></figure><h3>3) How much percentage of sales generated in each ship mode in each category</h3><p>Create a Pivot Table by dragging <strong>sales, category, ship mode </strong>columns in the <strong>Values, Rows, Columns</strong> sections.</p><p>Now right-click on any number in the Pivot Table. Select <strong>Show Values As</strong> and select the <strong>% Grand Total </strong>option to find out the percentage of sales<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jk-NXgN26TnJcAOwWi_ogA.gif" /><figcaption>Video By Author: Example 3-Pivot Table(<strong>Show Value As</strong>)</figcaption></figure><h3>4) What are the total sales generated in California state in each category (Highest to lowest sales)</h3><blockquote><strong>Tip:</strong> You can use a <strong>filter or slicer</strong> to filter out data for California state.</blockquote><p><strong>Method 1: Filter Option</strong></p><p>Create a Pivot Table by dragging <strong>sales, category, state </strong>columns in the <strong>Values, Rows, Filters </strong>sections.</p><p>Click on the filter above the pivot table and select California from the list. Once data is filtered now to sort the values highest to lowest, right-click and select S<strong>ort </strong>and then<strong> </strong>select <strong>Sort Largest to Smallest.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jiaXVg2_tG1vRTrWNXKjLA.gif" /><figcaption>Video By Author: Example 4.1-Pivot Table (<strong>Filter Option</strong>)</figcaption></figure><p><strong>Method 2: Slicer Option</strong></p><p>You will see how to use <strong>Slicer </strong>to filter the data.</p><p>Create a Pivot Table by dragging <strong>sales, category </strong>columns in the <strong>Values, Rows </strong>sections.</p><p>Select any cell in the pivot table and go to the <strong>PivotTable Analyze</strong> tab and select the <strong>Insert Slicer </strong>option. It will pop up with the list of columns, select state and then California.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7mTM4FyPFKt622Tmn8wkCg.gif" /><figcaption>Video By Author: Example 4.1-Pivot Table (<strong>Slicer Option</strong>)</figcaption></figure><h3><strong>5) What are the total sales generated by Los Angeles and San Francisco city in each category (Different reports for each city)</strong></h3><p>Create a Pivot Table by dragging <strong>sales, category, city </strong>columns in the <strong>Values, Rows, Filters </strong>sections.</p><p>Click on the filter above the pivot table and select Los Angeles and San Francisco from the list.</p><p>Go to the <strong>PivotTable Analyze</strong> tab -&gt;<strong>PivotTable</strong> -&gt;<strong>Options-&gt;Show Report Filters Pages.</strong></p><blockquote><strong>Tip:</strong> Make sure to check the <strong>Select Multiple Items </strong>option so you can select multiple items.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lEDIDaHh0pcvyNgMYKR0ng.gif" /><figcaption>Video By Author: Example 5-Pivot Table (<strong>Show Report Filter Pages</strong>)</figcaption></figure><h3>6) Grouping</h3><p>PivotTable data can be grouped, you can group most items but dates are the most common items to group.</p><p>Click on the cell that has value you want to group and go to PivotTable Analyze tab select <strong>Group selection or Group Field </strong>option.</p><p>In the below example by default, dates are grouped into years, quarters, months. Now dates are grouped into years.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o51qvWvvR6dtIHQcBmsRyA.gif" /><figcaption>Video By Author: Pivot Table (<strong>Grouping Data</strong>)</figcaption></figure><blockquote><strong>Tip:</strong></blockquote><blockquote>To group, select a cell that has values to group and right-click and select<strong> Group </strong>option.</blockquote><blockquote>To ungroup, select a cell that has values to group and right-click and select<strong> UnGroup </strong>option.</blockquote><h3>7) Pivot Chart</h3><p>Create pivot table by using <strong>sales, state</strong> column. Now click on the pivot table, go to the <strong>PivotTable Analyze</strong> tab and select <strong>PivotChart.</strong> Depends on your requirement select what kind of chart you need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bv5wesVhpZZrHVpIMHLwxw.gif" /><figcaption>Video By Author: <strong>Pivot Chart</strong></figcaption></figure><h3>8) Refresh Data</h3><p>Situation 1: You want to edit the existing data and see updates in the existing pivot table as well.</p><p><strong>Edit the data -&gt; select pivot table -&gt; PivotTable Analyze tab -&gt; Select Refresh</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vE3g3daagO7TKSVcoufE9g.gif" /><figcaption>Video By Author: Pivot Table (<strong>Refresh Edited Data</strong>)</figcaption></figure><p>Situation 2: You want to add new data and see updates in the existing pivot table as well.</p><p><strong>Add new data -&gt; select pivot table -&gt; PivotTable Analyze tab -&gt; Select Change Data Source</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H2bo6gZf6vd57s2Us2unHQ.gif" /><figcaption>Video By Author: Pivot Table (<strong>Refresh New Data</strong>)</figcaption></figure><p>PivotTable are must if you are data analyst, in few clicks you can create PivotTable and see the patterns and trends in the data.</p><p><strong>Thanks you for reading :)</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=547b78faaa20" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/excel-meet-pivottables-547b78faaa20">Excel, Meet PivotTables</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Make Your Data Analysis Easy By Using Excel]]></title>
            <link>https://medium.com/analytics-vidhya/make-your-data-analysis-easy-by-using-excel-836cf7c95aab?source=rss-d993e54b6a45------2</link>
            <guid isPermaLink="false">https://medium.com/p/836cf7c95aab</guid>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[excel-function]]></category>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[excel-tips]]></category>
            <category><![CDATA[data-analysis-using-excel]]></category>
            <dc:creator><![CDATA[Ektamanvar]]></dc:creator>
            <pubDate>Wed, 14 Jul 2021 20:54:27 GMT</pubDate>
            <atom:updated>2021-07-20T05:15:25.978Z</atom:updated>
            <content:encoded><![CDATA[<h4>Simple Yet Powerful Excel Functions Included</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*boRTB9YnH6QvdAhu" /><figcaption>Photo by <a href="https://unsplash.com/@mbaumi?utm_source=medium&amp;utm_medium=referral">Mika Baumeister</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Dataset I am using is a <a href="https://www.briandunning.com/sample-data/">dummy dataset</a>. Here and there I included tips so make sure you keep eye on them. Refer to images for examples to get an idea of how exactly formulas can be used.</p><h3><strong>1. CONCAT()</strong></h3><p>Joins the text from multiple ranges or strings. Can specify any kind of delimiters while joining the text.</p><pre>Syntax: CONCAT(Text1, [Text2],…)</pre><pre>In the example space delimiter used</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*Ldu9JIDejNtNMVNG02UA3Q.jpeg" /><figcaption>Image By Author: CONCAT() in Excel</figcaption></figure><blockquote><strong>Tip:</strong> Common delimiters are space, comma(,), semicolon(;), pipes(|), slashes ( / \ ), Hyphen(-). It all depends on the requirment what kind of delimiter want to use.</blockquote><h3><strong>2. TRIM()</strong></h3><p>Removes leading and trailing spaces from the text except for single spaces between words. Often happens when you get data from other sources it has lots of white space and you have to remove those spaces otherwise it will considered as unique entry.</p><pre>Syntax: TRIM(Text)</pre><pre>In the example there is leading space</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*gQGNrRZ3dc4O1kzOoIBWdQ.jpeg" /><figcaption>Image By Author: TRIM() in Excel</figcaption></figure><h3><strong>3. VALUE()</strong></h3><p>Converts numbers stored as text into numbers.</p><pre>Syntax: VALUE(Text)</pre><pre>In the example see Age column value that stored as text </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*KH2xcbbAJ5IhOcdWC3cEcQ.jpeg" /><figcaption>Image By Author: VALUE() in Excel</figcaption></figure><blockquote><strong>Tip:</strong> By default number is always right side of the cell but<strong> when number stored as text it is on left side.</strong></blockquote><h3>4. LOWER(), UPPER(), PROPER()</h3><p>These three functions converts text to lower, upper and sentence case respectively (First letter of each word capital). It will be helpful in converting different cases into single case while doing data analysis project.</p><pre>Syntax: LOWER(Text)/ UPPER(Text)/ PROPER(Text)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*j8jGxmtdIKZJjbElz-K2-w.jpeg" /><figcaption>Image by Author: UPPER(),LOWER(),PROPER() in Excel</figcaption></figure><h3><strong>5. LEN(), LEFT(), RIGHT(), MID(), FIND()</strong></h3><p>LEN() function returns the length of the string.</p><pre>Syntax: LEN(Text)</pre><p>LEFT(), RIGHT(), MID() function returns the specified number of characters from the string.</p><pre>Syntax: <br>LEFT(Text, [Length])  - Returns from left side<br>        <br>RIGHT(Text, [Length]) - Returns from right side<br>        <br>MID(Text, Start, Num) - Returns specified number of characters</pre><p>FIND() function returns the position of the string. It can be used with len, left, right and mid function to get desired output</p><pre>Syntax: FIND(Find_text, Within_text, [Start_num])</pre><blockquote>FIND(what you want to find, where you want to find, From where to start)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*jopJ7TPKzxCUnq6TdqOQow.jpeg" /><figcaption>Image By Author: LEN(), LEFT(), RIGHT(), MID(), FIND() in Excel</figcaption></figure><h3><strong>6. COUNTIFS(), SUMIFS()</strong></h3><p>COUNTIFS() function counts the number of items that meet criteria and can specify any criteria.</p><pre>Syntax: COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2]…)</pre><p>SUMIFS() function adds all the values that meet criteria, can specify any number of criteria.</p><pre>Syntax: SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)</pre><blockquote><strong>Tip:</strong> Criteria can be</blockquote><blockquote>1) Wildcards (*, ?)</blockquote><blockquote>2) Expression ( “&gt;20”, “&lt;5”, “=15&quot;, “&lt;&gt;RED&quot;)</blockquote><blockquote>3) Numeric Value (10, 1/10, 23.2)</blockquote><blockquote>4) Text String (“string”)</blockquote><blockquote>5) Boolean Value (TRUE or FALSE)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*49BRAFL7U1TmZpawAsV3Jg.jpeg" /><figcaption>Image by Author: COUNTIFS(), SUMIFS() IN Excel</figcaption></figure><p>Let me explain one of the example in detail</p><pre>=COUNTIFS(E2:E501,&quot;ON&quot;,F2:F501,&quot;&gt;5000&quot;,C2:C501,K8)</pre><pre>Counts whose age is 33 from ON Province and sales greater than $5000. </pre><pre>33 is in another cell (K8), you can use cell reference as well. See picture for reference. </pre><blockquote><strong>Tip: Select entire column-Ctrl+Shift+↓</strong></blockquote><blockquote>To select entire column first select cell the from where you want to start the selection, then press Ctrl+Shift and down arrow.</blockquote><h3>7. IF(), NestedIFS, IFERROR()</h3><p>IF() checks whether a condition is met, and returns one value if TRUE, another value if FALSE. Nested IFS is also possible.</p><pre>Syntax: IF(logical_test, [value_if_true], [value_if_false])</pre><p>IFERROR() checks the formula if it evaluates error then it returns another value you specified.</p><pre>Syntax: IFERROR(value, value_if_error)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*pE_mP32s7PztTTLBeRGcyw.jpeg" /><figcaption>Image by Author: IF(), IFERROR() IN Excel</figcaption></figure><p>Now let us dig into an example</p><pre>=IF(F8&lt;2000,&quot;NoDiscount&quot;,IF(F8&lt;=2500,&quot;2% Discount&quot;,IF(F8&lt;=4000,&quot;5% Discount&quot;,IF(F8&lt;=7000,&quot;10% Discount&quot;,&quot;12% Discount&quot;))))</pre><pre>This complex nested IF statement follows a straightforward logic:</pre><pre>If the sales (in cell F8) is less than 2000, then they gets &quot;NoDiscount&quot;</pre><pre>If the sales is less than or equals to 2500, then they gets &quot;2% Discount&quot;</pre><pre>If the sales is less than or equals to 4000, then they gets &quot;5% Discount&quot;</pre><pre>If the sales is less than or equals to 7000, then they gets &quot;10% Discount&quot;</pre><pre>Otherwise &quot;12% Discount&quot;</pre><h3>8. VLOOKUP(), MATCH(), INDEX()</h3><p>VLOOKUP() looks for a specified value in a specified table array and returns the value that you are looking for. It is one of the most popular, widely used function in excel.</p><pre>Syntax: VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])</pre><blockquote>VLOOKUP(what you want to look up, where you want to lookup, column number in the range containing the value to return, approximate -TRUE/exact match — FALSE)</blockquote><p>MATCH() returns the position of the value in a given range.</p><pre>Syntax: MATCH(lookup_value, lookup_array,[match_type])</pre><blockquote>MATCH(what you want to look up, where you want to look up, 0 exact match/ 1 less than/ -1 greater than)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*TRWX4_TIEuFs1pivzqPJug.jpeg" /><figcaption>Image by Author: VLOOKUP(), MATCH() in Excel</figcaption></figure><blockquote><strong>Tips:</strong></blockquote><blockquote>1. Vlookup works vertically (See image for reference)</blockquote><blockquote>2. Always makesure lookup_value is always on left side of the table and value you want to return is always on right side of the table, otherwise excel throughs error.</blockquote><p>In the example, lookup_value(First_Name) is on the left side and the value to return (Sales) is on the right side. Position of the column returned dynamically by using MATCH() see above picture for reference.</p><p>Now its time to go into a detailed explanation</p><pre>=VLOOKUP(I1,A2:F501,MATCH(H11,A1:F1,0),FALSE)</pre><pre>VLOOKUP() looks for I1(Hui) value in the A2:F501 table array and returns value based upon the column index num returned by MATCH()</pre><pre>MATCH() looks for H14(Sales) value in the A1:F1 table array (First_Name,Last_Name,Age,City,Province,Sales) and returns the column number</pre><p>INDEX() returns the specific value in the two-dimensional range. Works with both row and column.</p><pre>Syntax: INDEX(array, row_num, [col_num])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*19n9OYQd6fzafg1nmqtz1A.jpeg" /><figcaption>Image by Author: INDEX(), MATCH() in Excel</figcaption></figure><p>Example detail explanation</p><pre>=INDEX(B2:D6,MATCH(B12,A2:A6,0),MATCH(B11,B1:D1,0))</pre><pre>B2:D6 -&gt; Returns value from this array, no need to include row and column headings</pre><pre>MATCH(B12,A2:A6,0) -&gt; Returns row number<br>Looks for B12(Banana) in the A2:A6 array (Apple,Orange,Banana       Water Melon,Mango) and returns the row number when exact match found</pre><pre>MATCH(B11,B1:D1,0) -&gt; Returns column number<br>Looks for B11(Jan) in the B1:D1 array(Jan,Feb,Mar) and returns the column number when exact match found</pre><p>Wrapping up,</p><p>Data that you get is not always the way you want, need to clean your data to get accurate insights by using functions covered in the post. If your master COUNTIFS(), VLOOKUP(), MATCH(), NestedIFS and text functions will surely make your data analysis process faster.</p><p><strong>Thank you for reading :)</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=836cf7c95aab" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/make-your-data-analysis-easy-by-using-excel-836cf7c95aab">Make Your Data Analysis Easy By Using Excel</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get Started With Pandas In 10 Mins]]></title>
            <link>https://medium.com/analytics-vidhya/pandas-for-data-analysis-664e280ad6e7?source=rss-d993e54b6a45------2</link>
            <guid isPermaLink="false">https://medium.com/p/664e280ad6e7</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Ektamanvar]]></dc:creator>
            <pubDate>Sun, 21 Jun 2020 17:05:49 GMT</pubDate>
            <atom:updated>2020-07-19T16:37:35.343Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn Pandas in 10 minutes</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*KsVbVaK6Pc3rrGWJ_imBgA.jpeg" /><figcaption>Image source from medium post</figcaption></figure><p><strong>This article is divided into four parts:</strong></p><ol><li>Introduction to pandas</li><li>What pandas is capable of</li><li>Practical Implementation</li><li>Conclusion</li></ol><h3><strong>1. Introduction to Pandas</strong></h3><p>In simple terms, pandas is a fast, powerful, flexible, and easy to use software library written for a python programming language to do data analysis and data manipulation.</p><h3><strong>2. What pandas is capable of</strong></h3><ol><li>Importing and Exporting Data</li><li>Viewing and Inspecting Data</li><li>Selecting and Filtering Data</li><li>Grouping and Sorting Data</li><li>Handling Missing and Duplicate Data</li><li>Setting and Resetting Index</li><li>Reshaping Data</li><li>Merging Data</li><li>Date Formating</li></ol><h3><strong>3. Practical Implementation</strong></h3><p>Let’s start by importing the panda&#39;s library. Below is the syntax to import the library. Import is the keyword, pandas is a library name, and pd is the alias. By using alias all the functions of pandas are accessed.</p><pre>import pandas as pd</pre><h4><strong>1. Importing and Exporting Data</strong></h4><pre>#Importing data<br>data = pd.read_csv(&#39;titanic.csv&#39;)</pre><pre>#Exporting data<br>data.to_csv(&#39;output.csv&#39;)<br></pre><p>I am using a titanic dataset from Kaggle you can find <a href="https://github.com/Ekta-Manvar/Pandas-For-Data-Analysis">here</a>.</p><p>The first step in the data science project is to import the dataset. Often you will work with a common separate value(CSV) file. <strong>read_csv()</strong> function is used to import the dataset and<strong> to_csv()</strong> is used to export the dataset.</p><p>Data is the variable name and the variable is used to store any kind of data. Any variable name can be used. Different file formats of data can be imported and exported like Excel, Html, JSON, etc.</p><figure><img alt="This is how our imported data look likes" src="https://cdn-images-1.medium.com/max/1008/1*BuuyMh6TOZZFpFLjzwYgVA.png" /><figcaption>This is how imported dataset looks like</figcaption></figure><h4><strong>2. Viewing and Inspecting Data</strong></h4><pre>#Returns by default top five rows<br>data.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*eUfDg-aSrdSkSY7MDeqUFg.png" /></figure><pre>#Returns by default last five rows<br>data.tail()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*3o-FOGExIk06PlNX6Hs9ng.png" /></figure><pre>#Returns column names<br>data.columns</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*pOdUknhq_J0XTdyVXSdUAQ.png" /></figure><pre>#Returns column data types<br>data.dtypes</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*BXKZCnI8qnWnmC26jFpH7g.png" /></figure><pre>#Returns (Rows, Columns) of the dataset<br>data.shape<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*m6lU7IiKgt5zXEnvP9gg4w.png" /></figure><pre>#Returns total count of non NA values for each column <br>data.count()</pre><pre>#Age, Cabin, Embarked columns have NA values</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*sxZKboEO4YPm1H7e4fL8yw.png" /></figure><pre>#Returns basic statistical information of numeric columns only<br>data.describe()<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*E6YQMYjvJ1uKCjZ6cf_nDw.png" /></figure><pre>#Returns information of string type columns<br>data.describe(include=object)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*q9B4526zBhkX6dWZfaIpew.png" /></figure><pre>#Returns information about dataframe like index dtype and column dtypes, non-null values and memory usage<br>data.info()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*xPvmTYCzWdsgEuKbvJj61g.png" /></figure><pre>#Returns distinct count of observations for each column<br>data.nunique()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*b5RNuCHfRc_kEN_vn5dvGw.png" /></figure><pre>#Returns count of unique values for series(columns in our case)<br>data[&#39;Pclass&#39;].value_counts()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*sMPBhywgmo_E2adUdP-jtA.png" /></figure><pre>#Rename the column name<br>data.rename(columns= {“Name”:”Full Name”})</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*0e4G5K_PSWbladEk4Sy_OA.png" /></figure><pre>#Drop columns<br>data.drop(columns=[‘Name’,’Survived’,’Pclass’])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*US1t_Uph29eKTHazdsCngg.png" /></figure><h4><strong>3. Selecting and Filtering Data</strong></h4><pre>#Selects one column data<br>data[&#39;Name&#39;]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*e_fizJGzzn3eZVK6jI8VNw.png" /></figure><pre>#Selects more than one column data<br>data[[&#39;Sex&#39;,&#39;Name&#39;]]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*B6xtyeWhQLcFQFz63LQh7g.png" /></figure><pre>#Filters data based on condition<br>data[data[&#39;Age&#39;]&gt;50]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*sqJtC47U3KRbnBlMqIBBYQ.png" /></figure><pre>#Filters all rows and 3 columns<br>#loc() function filters by labels</pre><pre>data.loc[:, [&#39;Sex&#39;,&#39;Pclass&#39;,&#39;Age&#39;]]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*DixUNAU8e5MXCWkXgj5z4g.png" /></figure><pre>#Filters 100 to 400 rows and 2 columns<br>data.loc[100:400 :,[&#39;Survived&#39;,&#39;Sex&#39;]]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*rQr7dRVb6MKa5DHXEFMP9Q.png" /></figure><pre>#Filters all rows and columns from survived to sex columns<br>data.loc[:, &#39;Survived&#39;:&#39;Sex&#39;]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*mQ2m3ZCjdMDdTjGlXpdwng.png" /></figure><pre>#Filters rows based on condition (sex=female) and all columns<br>data.loc[data[&#39;Sex&#39;]==&#39;female&#39;, ]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*UbUnT6oJrNJj-llvLjBLsA.png" /></figure><pre><strong>#</strong>Filters all rows and 1 to 4 columns<br>#iloc() function filters by index<br>data.iloc[ :,1:4]</pre><pre>#index starts from zero and ignores last index while filtering</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*Jdk6BzqVwu_NrdKP7DmyaA.png" /></figure><pre>#Filters all rows and 1,4,6 columns<br>data.iloc[:,[1,4,6]]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*LakZTkR67oBfBqrNbp1vKg.png" /></figure><pre>#Filters rows from 150 to 400 and and 2,7,3 columns<br>data.iloc[150:400:,[2,7,3]]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*jpFJjk8NL8EHzqmBd6M26g.png" /></figure><h4><strong>4. Grouping and Sorting Data</strong></h4><pre>#Returns Survived column wise count<br>data.groupby(&#39;Survived&#39;).count()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*bXekXhpqO4t2sP5dXQbOkA.png" /></figure><pre>#Returns max age based on sex column<br>data.groupby(&#39;Sex&#39;)[&#39;Age&#39;].max()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/1*btL3Gjh97GLxjOpMvjiltQ.png" /></figure><pre>#Returns min age based on sex, survived columns<br>data.groupby([&#39;Sex&#39;,&#39;Survived&#39;])[&#39;Age&#39;].min()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*DjB9bld6iW4AcmXR9tctqg.png" /></figure><pre>#Multiple aggregation functions  <br>#Returns min,max of age based on parch &amp; survived<br>data.groupby([&#39;Parch&#39;,&#39;Survived&#39;])[&#39;Age&#39;].agg([min, max])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*OyTItRI0rK4JwBOyNIDVqQ.png" /></figure><pre>#Sorts the dataset based on specified column(default it sorts in ascending order)<br>data.sort_values(by=&#39;Name&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*3xVdNVkXcEMFiVXl6vpDmw.png" /></figure><pre>#Sorts the dataset based on specified column in decending order<br>data.sort_values(by=&#39;Name&#39;, ascending=False)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*RzOpIFwxr-zJCwZ1EEYM_w.png" /></figure><h4><strong>5. Handling Missing Data</strong></h4><pre>#Returns True or False <br>data.isnull()<br>data.isna()</pre><pre>#True -&gt; NA <br>#False -&gt; Not NA</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*FGVTtGFq-JNDjBGTdHDkYQ.png" /></figure><pre>#Fills all NA&#39;s with zero for both string nd numeric <br>#NA values can be filled with mean,median or mode as well.</pre><pre>data.fillna(0)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*OFSWE2wb_CzzR5EsFKSFcA.png" /></figure><pre>#Drops rows if the row has at least one NA value<br>data.dropna(how=&#39;any&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*uAI2ZGuU2RiGoj6IlEmPiA.png" /></figure><p>See how rows got decreased from 891 to 183, be cautious when you use dropna() function because it drops a lot of valuable data.</p><pre>#Drops rows if the row have all NA values<br>data.dropna(how=’all’)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*7P6DplCg0I8_RMVUVmDMfw.png" /></figure><p>In our case, we don&#39;t have any such row that has all NA values.</p><pre>#Drops columns if the column have at least one NA value<br>data.dropna(axis=’columns’, how=’any’)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*G6dWxZxg5Kj-bUrqQY_ERg.png" /></figure><p>Age, Cabin, Embarked columns dropped.</p><pre>#Checks if the whole row appears elsewhere with the same values. <br>data.duplicated()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*hVar77pYHNCCUJhqa1gCOQ.png" /></figure><pre>#Checks if there are any duplicate values of a particular column<br>data.duplicated(‘Age’)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*BJ7VNyKJUYo_HEQAOYGBzQ.png" /></figure><pre>#Drops duplicate records <br>data.drop_duplicates()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*_2JfY2yQ37mErEMEAF5okg.png" /></figure><p>In our case, we don&#39;t have any duplicate records.</p><pre>#Drops duplicates from particular column<br>data.drop_duplicates(‘Age’)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*p4hfchsL4AvSI8XCn1l9gQ.png" /></figure><p>See how rows got decreased from 891 to 89, be cautious when you use drop_duplicates() function because it drops a lot of valuable data. In our case obviously with the same age group traveled in titanic. Just used for example only.</p><h4><strong>6. Setting and Resetting Index</strong></h4><pre>#Sets index based on specified column <br>data.set_index(‘Sex’)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*BmV2tFaivrgB2rOEbZ5cXg.png" /></figure><pre>#Sets index based on specified columns<br>data.set_index([‘Sex’,’PassengerId’])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*Unq5AhEcVY5WrSzdSygWhQ.png" /></figure><pre>#Reset index <br>data1.reset_index()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*BFr8Wf6MPeztR0SZsrCQwg.png" /></figure><p>Now Sex, PassengerId columns are reset back to normal columns.</p><h4><strong>7. Reshaping Data</strong></h4><pre>#melt() function is used to convert dataframe from wide format to long format</pre><pre>data.melt(id_vars=&#39;PassengerId&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*X1vlj1vPvVO_OClFEJaoJw.png" /></figure><pre>#melt() function can be used for particular columns as well</pre><pre>data.melt(id_vars=&#39;PassengerId&#39;, value_vars=[&#39;Survived&#39;,&#39;Sex&#39;], var_name=&#39;Columns&#39;, value_name=&#39;Column_values&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*nzvzdD-lkOUaXIRO47wBWA.png" /></figure><pre>#pivot() function is used to reshape dataframe based on index/columns values. Results into multiindex<br># don&#39;t support aggregation function</pre><pre>data.pivot(index=&#39;PassengerId&#39;, columns=&#39;Sex&#39;, values=[&#39;Survived&#39;,&#39;Pclass&#39;,&#39;Age&#39;])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*lIfxBJXZXyI_sjm2LqHmJA.png" /></figure><pre>#pivot_table is used for data aggregation <br>#Obersvations are filled with sum of age values</pre><pre>data.pivot_table(index=’PassengerId’, columns=’Sex’, values=’Age’, aggfunc=’sum’)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*UTv3a_6KsymWiPMB7SLIIA.png" /></figure><h4><strong>8. Merging Data</strong></h4><p>Let&#39;s create data frames to demonstrate Merge and Concat functions</p><pre>df1 = pd.DataFrame({“x1”: [“a”,”b”,”c”,”d”], “x2”:[12.0, 23.2, 56, 45.4]})<br> df1</pre><pre>df2 = pd.DataFrame({“x1”: [“a”,”b”,”c”,”e”], “x3”:[9.5, 37.0, 77,38.9]})<br>df2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*fwuzmlmOP0xaD7la2rz8dg.jpeg" /></figure><pre>#Returns come data based on x1 column: inner join (a,b,c)<br>pd.merge(df1,df2,on=”x1&quot;)</pre><pre><br>#Merges both data based on x1 column: outer join (a,b,c,d,e)<br>pd.merge(df1,df2,on=&quot;x1&quot;, how=&quot;outer&quot;)<br></pre><pre>#Merges common data from both dataset and remaining data from left dataset<br>pd.merge(df1,df2,on=”x1&quot;, how=”left”)<br></pre><pre>#Merges common data from both dataset and remaining data from right dataset<br>pd.merge(df1,df2,on=&quot;x1&quot;, how=&quot;right&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*Xip9r3AMUkDiqIyPDtc-bw.jpeg" /></figure><p>Please note while merging if data is not there then it will replace with NaN values.</p><pre>#Concat function by default performs outer join and works row wise<br>pd.concat([df1,df2])</pre><pre>#Axis will be labeled 0, …, n - 1<br>pd.concat([df1,df2], ignore_index=True)</pre><pre>#Concatnates column wise<br>pd.concat([df1,df2], axis=1)</pre><pre>pd.concat([df1,df2], join=&quot;inner&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*PoOlJaaVtDLRRBsesmSvKQ.jpeg" /></figure><h4>9. Date Formating</h4><p>I am using the apple stock price dataset from the google finance website you can find <a href="https://github.com/Ekta-Manvar/Pandas-For-Data-Analysis">here</a>.</p><pre>#Load the dataset <br>data1 = pd.read_csv(‘applestock.csv’)</pre><pre>data1.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*EzKwGiBeZhWUPGKpUOzszQ.png" /></figure><pre>#Check the datatypes<br>data1.dtypes</pre><pre>#date column is object type not datetime format</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*togNBgm1lYXOPGs8Am6W4w.png" /></figure><pre>#to_datetime() — converts any format to datetime format</pre><pre>data1[‘Date’] = pd.to_datetime(data1[‘Date’])<br>data1.dtypes</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*0yhrtFAIBy9Hi_2ATyT5mg.png" /></figure><pre>#Extract year, month, day from date column</pre><pre>data1[‘Year’] = data1[‘Date’].dt.year<br>data1[‘Month’] = data1[‘Date’].dt.month<br>data1[‘day’] = data1[‘Date’].dt.day</pre><pre>data1.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*VRekT138oZyh35czBVQP6g.png" /></figure><pre>#pd.DatetimeIndex() — sets date as index<br>data1.index = pd.DatetimeIndex(data1[‘Date’])</pre><pre>#Once we set date as index, needs to del date column <br>data1.drop(columns=[‘Date’], inplace=True)</pre><pre>data1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*R3ZUFoVRxwS2SHJ212NLVA.png" /></figure><pre>#Resample() — resamples time series data based on specified frequency<br>data1[‘High’].resample(‘M’).sum()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*ehxemCjTAGHwMpMDLO0YBQ.png" /></figure><pre>#date_range() - creates array of datetime</pre><pre>#Creates 10 dates starting from 2020-01-05 with WEEK frequency<br>date1 = pd.date_range(start=&#39;2020-01-05&#39;, periods=10, freq=&#39;W&#39;)</pre><pre>#Creates 10 dates ending date is 2020-03-10 with MONTH frequency<br>date2 = pd.date_range(end=&#39;2020-03-10&#39;, periods=10, freq=&#39;M&#39;)</pre><pre>#Creates 10 dates ending date is 2020-03-10 with MONTH frequency<br>date3 = pd.date_range(start=&#39;2020-01-01&#39;, end=&#39;2020-06-01&#39;, freq=&#39;SM&#39;)</pre><pre>pd.DataFrame({&quot;Date1&quot;: date1, &quot;Date2&quot;: date2, &quot;Date3&quot;: date3})</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*8ERPebqXIRydWd3LkCt12A.png" /></figure><h3><strong>4. Conclusion</strong></h3><p>Once you go through this post you will be able to do data analysis using pandas like loading, Inspecting, Selecting, Filtering, Grouping, Sorting, and much more. If you want to practice the above examples <a href="https://github.com/Ekta-Manvar/Pandas-For-Data-Analysis">here is the link to my jupyter notebook.</a> These are only basic pandas functions you can do a more advanced level of data analysis also.</p><p><strong>Thank you for reading :)</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=664e280ad6e7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/pandas-for-data-analysis-664e280ad6e7">Get Started With Pandas In 10 Mins</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>