<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aspersh Upadhyay</title>
    <description>The latest articles on DEV Community by Aspersh Upadhyay (@aspershupadhyay).</description>
    <link>https://dev.to/aspershupadhyay</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1060983%2Fde133337-7a93-4ba5-882d-6a3c80bcef23.jpg</url>
      <title>DEV Community: Aspersh Upadhyay</title>
      <link>https://dev.to/aspershupadhyay</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aspershupadhyay"/>
    <language>en</language>
    <item>
      <title>SQL For Data Analysis -Basic To Advanced Queries</title>
      <dc:creator>Aspersh Upadhyay</dc:creator>
      <pubDate>Mon, 10 Jul 2023 12:30:02 +0000</pubDate>
      <link>https://dev.to/aspershupadhyay/sql-for-data-analysis-basic-to-advanced-queries-44j4</link>
      <guid>https://dev.to/aspershupadhyay/sql-for-data-analysis-basic-to-advanced-queries-44j4</guid>
      <description>&lt;p&gt;Master data analysis with this practical SQL guide&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ErdVbE14--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AlR4lg4jetBBY4nbnN1h8Og.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ErdVbE14--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AlR4lg4jetBBY4nbnN1h8Og.png" alt="SQL for Data Analysis — Basic to Advanced Queries" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Image by Author&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Learn how to leverage SQL’s powerful features like &lt;strong&gt;aggregates&lt;/strong&gt; , &lt;strong&gt;joins&lt;/strong&gt; , &lt;strong&gt;subqueries&lt;/strong&gt; , &lt;strong&gt;window functions&lt;/strong&gt; , and &lt;strong&gt;CTEs&lt;/strong&gt; to query, &lt;strong&gt;manipulate&lt;/strong&gt; , and gain insights from relational data. Whether you’re a beginner looking to learn SQL basics or an expert wanting to strengthen your data analysis skills, this tutorial will take your SQL queries to the next level.&lt;/p&gt;

&lt;p&gt;Follow along with clear examples demonstrating each concept so you can apply these data manipulation techniques in your own projects. By the end, you’ll have the SQL proficiency to extract game-changing business intelligence from your company’s data.&lt;/p&gt;
&lt;h3&gt;
  
  
  What is SQL?
&lt;/h3&gt;

&lt;p&gt;SQL stands for Structured Query Language, and it’s a programming language that’s used to manage and manipulate relational databases. Relational databases are collections of data that are organized into tables with rows and columns. SQL allows you to extract data from these tables, modify the data, and insert new data.&lt;/p&gt;
&lt;h4&gt;
  
  
  Basic SQL Syntax
&lt;/h4&gt;

&lt;p&gt;The basic syntax of SQL consists of commands that are used for creating, modifying, and querying databases. The syntax consists of commands such as SELECT, INSERT, UPDATE, DELETE, and CREATE. SQL commands are not case sensitive, but it is common practice to write them in uppercase. Now further real story begins.&lt;/p&gt;
&lt;h3&gt;
  
  
  Retrieving Data from a Single Table
&lt;/h3&gt;

&lt;p&gt;In SQL, the SELECT statement is used for retrieving data from a table. The FROM clause specifies which table you will use. The WHERE clause is used for filtering data, the ORDER BY clause is used for sorting data, and the LIMIT clause is used for limiting the number of rows returned.&lt;/p&gt;
&lt;h4&gt;
  
  
  SELECT &amp;amp; FROM
&lt;/h4&gt;

&lt;p&gt;The &lt;strong&gt;SELECT&lt;/strong&gt; statement specifies the columns that you want to retrieve, and it is followed by the column names that you want to select. If you want to retrieve all the columns, you can use the *symbol in place of the column names.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;FROM&lt;/strong&gt; clause specifies the table or tables from which you want to retrieve the data, and it is used after the SELECT statement. By combining the SELECT statement and FROM clause, you can retrieve specific columns or all columns from one or more tables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT first_name, last_name
FROM employees
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  WHERE
&lt;/h4&gt;

&lt;p&gt;The WHERE clause is used to filter data based on specific conditions. You can use various operators such as =, &amp;lt;&amp;gt;, &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, LIKE, IN, BETWEEN, IS NULL, and IS NOT NULL to define the conditions&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * FROM employees
WHERE salary &amp;gt; 50000 AND department = 'IT';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  ORDER BY
&lt;/h4&gt;

&lt;p&gt;The ORDER BY clause is used to sort data in ascending or descending order based on one or multiple columns. You can specify the ASC keyword for ascending order and DESC keyword for descending order. If no keyword is provided, the default is ascending order&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * FROM employees
ORDER BY last_name ASC, first_name DESC;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  LIMIT
&lt;/h4&gt;

&lt;p&gt;The LIMIT clause is used for limiting the number of rows returned. It is used to limit the number of rows returned to a certain number.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT id, name, salary
FROM employees
LIMIT 30;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Joins — Retrieve data from mulitple tables
&lt;/h3&gt;

&lt;p&gt;In SQL, the JOIN operation is used for retrieving data from multiple tables. There are four types of JOIN operations — INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN.&lt;/p&gt;

&lt;h4&gt;
  
  
  INNER JOIN
&lt;/h4&gt;

&lt;p&gt;An INNER JOIN returns only the rows that have matching values in both tables. It is the most common type of JOIN operation. In this case, the result set will only include the records where there is a match in both tables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT employees.name, departments.department_name
FROM employees
INNER JOIN departments 
ON employees.department_id = departments.department_id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  LEFT JOIN
&lt;/h4&gt;

&lt;p&gt;A LEFT JOIN returns all the rows from the left table (table1) and the matched rows from the right table (table2). If there is no match, NULL values are returned for the columns from the right table.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT employees.name, departments.department_name
FROM employees
LEFT JOIN departments 
ON employees.department_id = departments.department_id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  RIGHT JOIN
&lt;/h4&gt;

&lt;p&gt;A RIGHT JOIN works similarly to a LEFT JOIN, but it returns all the rows from the right table (table2) and the matched rows from the left table (table1). If there is no match, NULL values are returned for the columns from the left table.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT employees.name, departments.department_name
FROM employees
RIGHT JOIN departments 
ON employees.department_id = departments.department_id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  FULL OUTER JOIN
&lt;/h4&gt;

&lt;p&gt;A FULL OUTER JOIN combines the results of both LEFT JOIN and RIGHT JOIN. It returns all the rows from both tables, with NULL values for unmatched columns.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT employees.name, departments.department_name
FROM employees
FULL OUTER JOIN departments 
ON employees.department_id = departments.department_id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Bonus — SELF JOIN
&lt;/h4&gt;

&lt;p&gt;A self join is a type of SQL join where a table is &lt;strong&gt;joined to itself&lt;/strong&gt;. It is used to combine rows from the same table based on a related column. Self joins are useful when you want to compare rows within the same table or find relationships between the rows of the same table. To perform a self join, you need to use aliases to differentiate the two instances of the same table.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT e1.employee_name AS Employee, e2.employee_name AS Manager
FROM employees e1
JOIN employees e2 ON e1.manager_id = e2.employee_id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Filtering and Sorting Data
&lt;/h3&gt;

&lt;p&gt;In SQL, the GROUP BY clause is used for grouping data, and the HAVING clause is used for filtering data after grouping. WHERE and ORDER BY We have already covered it in above section👆&lt;/p&gt;

&lt;h4&gt;
  
  
  GROUP BY clause
&lt;/h4&gt;

&lt;p&gt;The GROUP BY clause is used for grouping data based on one or more columns. It is used with aggregate functions such as COUNT, SUM, AVG, MIN, and MAX.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT department, COUNT(*) as employee_count
FROM employees
GROUP BY department;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  HAVING clause
&lt;/h4&gt;

&lt;p&gt;The HAVING clause is a useful feature in SQL that allows you to filter the results of a query based on a condition applied to aggregated data. It is often used in conjunction with the GROUP BY clause, which groups rows with similar values together. The HAVING clause is particularly helpful when you want to retrieve specific groups based on a certain criteria, such as the sum or average of a column.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT product_id, SUM(quantity_sold) as total_units_sold
FROM sales
GROUP BY product_id
HAVING total_units_sold &amp;gt; 100;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  LIKE operator with wildcards
&lt;/h4&gt;

&lt;p&gt;The LIKE operator is used in conjunction with wildcards to filter data based on patterns. The % wildcard represents any number of characters, while the _ wildcard represents a single character.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * FROM employees
WHERE last_name LIKE 'Smi%';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Aggregate Function
&lt;/h3&gt;

&lt;p&gt;Aggregate functions are used to perform calculations on a set of values, and they return a single value as the result. They are super helpful when you need to analyze and summarize data in your database.&lt;/p&gt;

&lt;p&gt;Some common aggregate functions in SQL are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;COUNT()&lt;/strong&gt;: This function returns the number of rows that match a specified condition.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SUM()&lt;/strong&gt;: This function returns the total sum of a numeric column.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AVG()&lt;/strong&gt;: This function returns the average value of a numeric column.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MIN()&lt;/strong&gt;: This function returns the smallest value of a selected column.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MAX()&lt;/strong&gt;: This function returns the largest value of a selected column.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let me show you some examples of how to use these aggregate functions in SQL:&lt;/p&gt;

&lt;h4&gt;
  
  
  COUNT():
&lt;/h4&gt;

&lt;p&gt;Suppose you have a table called ‘employees’ and you want to know the total number of employees. You can use the COUNT() function like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT COUNT(*) FROM employees;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  SUM():
&lt;/h4&gt;

&lt;p&gt;If you want to calculate the total salary of all employees, you can use the SUM() function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT SUM(salary) FROM employees;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  AVG():
&lt;/h4&gt;

&lt;p&gt;To find the average salary of all employees, you can use the AVG() function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT AVG(salary) FROM employees;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  MIN():
&lt;/h4&gt;

&lt;p&gt;If you want to find the employee with the lowest salary, you can use the MIN() function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT MIN(salary) FROM employees;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  MAX():
&lt;/h4&gt;

&lt;p&gt;vvSimilarly, to find the employee with the highest salary, you can use the MAX() function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT MAX(salary) FROM employees;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use aggregate functions with the GROUP BY clause to group the results by one or more columns. For example, if you want to find the total salary for each department, you can do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT department_id, SUM(salary) 
FROM employees 
GROUP BY department_id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;J&lt;/em&gt; &lt;strong&gt;&lt;em&gt;ust a Quick Reminder&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;: Feel free to follow&lt;/em&gt; &lt;a href="https://medium.com/u/5e486906a837"&gt;&lt;strong&gt;&lt;em&gt;Aspersh Upadhyay&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;em&gt;for more such interesting topics. If you want free learning resources related to Data Science and related field. Join our Telegram Channel&lt;/em&gt; &lt;a href="http://bit.ly/bitsofds"&gt;&lt;strong&gt;&lt;em&gt;Bit of Data Science&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Subqueries
&lt;/h3&gt;

&lt;p&gt;Subqueries are a powerful feature in SQL that allows you to perform complex queries by breaking them down into smaller, more manageable parts. In simple terms, a subquery is a query embedded within another query, often used to filter or modify the results of the outer query. They can be used in various parts of a SQL query, such as the SELECT, WHERE, and JOIN clauses.&lt;/p&gt;

&lt;p&gt;Let’s dive into the details of subqueries with a few examples:&lt;/p&gt;

&lt;h4&gt;
  
  
  Basic subquery:
&lt;/h4&gt;

&lt;p&gt;A basic subquery is a query that is enclosed within parentheses and used within the SELECT, WHERE, or JOIN clause of another query. It returns a result set that can be used as a value or a condition for the outer query.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * FROM employees 
WHERE salary &amp;gt; (SELECT AVG(salary) FROM employees);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Correlated subquery:
&lt;/h4&gt;

&lt;p&gt;A correlated subquery is a subquery that refers to a value in the outer query. It is used to filter or modify the results of the outer query based on the value of a specific column in the outer query.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * 
FROM employees 
WHERE department_id = (SELECT department_id FROM departments WHERE name = 'IT');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Nested subquery:
&lt;/h4&gt;

&lt;p&gt;A nested subquery is a subquery that is used within another subquery. This can be useful when you need to perform complex calculations or comparisons based on multiple levels of data.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * 
FROM employees 
WHERE salary &amp;gt; (SELECT AVG(salary) 
FROM (SELECT * FROM employees WHERE department_id = 1));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Common Table Expressions (CTEs)
&lt;/h3&gt;

&lt;p&gt;Common Table Expressions, or CTEs, are a powerful feature in SQL that allows you to create temporary result sets that can be referenced within a SELECT, INSERT, UPDATE, or DELETE statement. CTEs are particularly useful for simplifying complex queries, breaking them down into smaller, more manageable parts. They can also be used to create recursive queries for hierarchical data.&lt;/p&gt;

&lt;p&gt;To create a CTE, you use the &lt;strong&gt;WITH&lt;/strong&gt; keyword followed by the CTE name and the column names in parentheses. Then, you provide the query that defines the CTE. Let’s take a look at a simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WITH customer_total_orders (customer_id, total_orders) AS (
  SELECT customer_id, COUNT(*) as total_orders
  FROM orders
  GROUP BY customer_id
)
SELECT *
FROM customer_total_orders
WHERE total_orders &amp;gt; 10;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CTEs can also be chained together, allowing you to reference one CTE in another. Here’s an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WITH customer_total_orders (customer_id, total_orders) AS (
  SELECT customer_id, COUNT(*) as total_orders
  FROM orders
  GROUP BY customer_id
),
top_customers (customer_id) AS (
  SELECT customer_id
  FROM customer_total_orders
  WHERE total_orders &amp;gt; 10
)
SELECT c.*, t.total_orders
FROM customers c
JOIN top_customers tc ON c.customer_id = tc.customer_id
JOIN customer_total_orders t ON c.customer_id = t.customer_id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, CTEs can be used to create recursive queries. For example, if you have a table storing hierarchical data, such as employees and their managers, you can use a recursive CTE to retrieve the entire hierarchy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WITH RECURSIVE employee_hierarchy (employee_id, manager_id, level) AS (
  SELECT employee_id, manager_id, 1 as level
  FROM employees
  WHERE manager_id IS NULL

  UNION ALL

  SELECT e.employee_id, e.manager_id, eh.level + 1
  FROM employees e
  JOIN employee_hierarchy eh ON e.manager_id = eh.employee_id
)
SELECT *
FROM employee_hierarchy;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Window Function
&lt;/h3&gt;

&lt;p&gt;Window functions in SQL are a powerful tool that allows you to perform calculations across a set of rows related to the current row. They are called “ &lt;strong&gt;window functions&lt;/strong&gt; ” because they provide a “ &lt;strong&gt;window&lt;/strong&gt; ” into the surrounding data. Here are commonly used window functions:&lt;/p&gt;

&lt;h4&gt;
  
  
  ROW_NUMBER()
&lt;/h4&gt;

&lt;p&gt;ROW_NUMBER() assigns a unique number to each row within the result set. It’s useful when you want to assign a sequential order to rows, like ranking or pagination.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT name, age, 
ROW_NUMBER() OVER (ORDER BY age) as row_number
FROM people;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  RANK()
&lt;/h4&gt;

&lt;p&gt;RANK() assigns a unique rank to each row within the result set, with the same rank assigned to rows with equal values. Rows with equal values get the same rank, and the next rank will be skipped.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT name, score, 
RANK() OVER (ORDER BY score DESC) as rank
FROM exam_results;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  DENSE_RANK()
&lt;/h4&gt;

&lt;p&gt;DENSE_RANK() is similar to RANK(), but it doesn’t skip any rank numbers. It assigns a unique rank to each row within the result set, with the same rank assigned to rows with equal values.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT name, score, 
DENSE_RANK() OVER (ORDER BY score DESC) as dense_rank
FROM exam_results;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  SUM()
&lt;/h4&gt;

&lt;p&gt;SUM() calculates the cumulative sum of a specific column’s value across the rows in the window frame. It’s useful when you want to find running totals.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT date, sales, 
SUM(sales) OVER (ORDER BY date) as cumulative_sales
FROM daily_sales;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  AVG()
&lt;/h4&gt;

&lt;p&gt;AVG() calculates the average of a specific column’s value across the rows in the window frame. It’s useful when you want to find the moving average.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT date, temperature, 
AVG(temperature) 
OVER (ORDER BY date ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) as moving_average
FROM daily_temperatures;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion:
&lt;/h3&gt;

&lt;p&gt;SQL is a powerful and versatile programming language that can help you perform data analysis on relational databases. In this article, you learned the basics of SQL syntax, how to join data from multiple tables, how to filter and sort data, how to use aggregate functions, subqueries, common table expressions, and window functions. By applying these skills, you can query and manipulate data in various ways and gain insights from your data.&lt;/p&gt;

&lt;p&gt;I hope you enjoyed this article and found it useful for your data analysis projects. If you have any questions or feedback, please let me know in the comments below. Thank you for reading!&lt;/p&gt;

&lt;p&gt;For more exciting insights into the world of data and machine learning, be sure to follow me on &lt;a href="https://medium.com/@aspershupadhyay"&gt;&lt;strong&gt;Medium&lt;/strong&gt;&lt;/a&gt; and connect with me on &lt;a href="https://www.linkedin.com/in/aspersh-upadhyay/"&gt;&lt;strong&gt;LinkedIn&lt;/strong&gt;&lt;/a&gt;. I publish articles regularly and would love to continue the conversation with you!&lt;/p&gt;

&lt;p&gt;Wanna Free Resources for Data Science, Artificial Intelligence, Machine Learning, Python, SQL and more. Join our Telegram channel &lt;a href="http://bit.ly/bitsofds"&gt;&lt;strong&gt;Bits of Data Science&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to support me for writing, you can buy me a &lt;a href="https://www.buymeacoffee.com/aspershupadhyay"&gt;&lt;strong&gt;cup of coffee&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;.&lt;/strong&gt; Would be greatly appreciated.&lt;/p&gt;

&lt;p&gt;Happy Learning SQL! 😀&lt;/p&gt;

</description>
      <category>dataanalysis</category>
      <category>datascience</category>
      <category>data</category>
      <category>sql</category>
    </item>
    <item>
      <title>20 Must-Know Topics in Deep Learning for Beginners</title>
      <dc:creator>Aspersh Upadhyay</dc:creator>
      <pubDate>Sun, 12 Feb 2023 19:00:09 +0000</pubDate>
      <link>https://dev.to/aspershupadhyay/20-must-know-topics-in-deep-learning-for-beginners-21nc</link>
      <guid>https://dev.to/aspershupadhyay/20-must-know-topics-in-deep-learning-for-beginners-21nc</guid>
      <description>&lt;p&gt;Essential Deep Learning Concepts Explained Intuitively&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9bXxYn8R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AsWD2v4qY5qKDRI51CLJ0rw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9bXxYn8R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AsWD2v4qY5qKDRI51CLJ0rw.png" alt="" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Are you new to deep learning and looking for a comprehensive guide to help you understand the basics and beyond? Look no further! In this article, we will delve into 20 essential deep learning concepts, starting with the basics and gradually moving on to more advanced topics. From Artificial Neural Network (ANN) to Gradient Descent and Activation Functions (Sigmoid, ReLU, SoftMax), we will explore everything you need to know to gain a solid foundation in deep learning. So, grab your coffee and let’s get started!&lt;/p&gt;

&lt;h3&gt;
  
  
  Neurons:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---2fxZbrf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/487/1%2Afs4O75WLLFBb4nzeCYqDZg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---2fxZbrf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/487/1%2Afs4O75WLLFBb4nzeCYqDZg.png" alt="" width="487" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A neuron is a basic building block of a neural network. It’s like a tiny computer that can perform simple calculations and make decisions based on inputs. Neurons are connected to each other in a network, and they work together to perform complex tasks, such as image classification or language translation. The inputs to a neuron are numbers that represent the information, and the output of a neuron is a decision about what to do with that information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt; : Let’s say you have a group of friends, and you want to play a game of “Telephone”. In this game, one person whispers a message to the next person, and so on, until the message has been passed to everyone in the group. Each person in the group is like a neuron in a neural network, receiving information from one person and passing it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Activation Function (Sigmoid, ReLU, SoftMax)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WjKxOPox--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/345/1%2AjOzI7gFes4HTBc6UeIjfQg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WjKxOPox--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/345/1%2AjOzI7gFes4HTBc6UeIjfQg.png" alt="" width="345" height="238"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The activation function is like a gatekeeper for each neuron in the ANN. It decides whether a neuron should be “turned on” or “turned off.” Different types of activation functions perform this decision-making process in different ways.&lt;/p&gt;

&lt;h4&gt;
  
  
  Sigmoid:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SS6W3tRL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/274/1%2AEqcD4swGCfKOmF4cjgad3A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SS6W3tRL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/274/1%2AEqcD4swGCfKOmF4cjgad3A.png" alt="" width="274" height="182"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The sigmoid function is like a light switch. It turns the neuron on or off based on the input. If the input is above a certain threshold, the sigmoid function outputs a value of 1, which turns the neuron on. If the input is below the threshold, the sigmoid function outputs a value of 0, which turns the neuron off.&lt;/p&gt;

&lt;h4&gt;
  
  
  ReLU:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---PuA5KtI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/282/1%2ADVknGc-ERHqA6JtEgcVbXA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---PuA5KtI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/282/1%2ADVknGc-ERHqA6JtEgcVbXA.png" alt="" width="282" height="177"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The ReLU (rectified linear unit) function is like a light switch, too, but it’s a bit more sophisticated. If the input is positive, the ReLU function outputs the same positive value, which turns the neuron on. If the input is negative, the ReLU function outputs 0, which turns the neuron off.&lt;/p&gt;

&lt;h4&gt;
  
  
  SoftMax:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wEGIrDxN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/254/1%2Alu_Uzl25TKZeDBV8HfFyNg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wEGIrDxN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/254/1%2Alu_Uzl25TKZeDBV8HfFyNg.png" alt="" width="254" height="198"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The SoftMax function is like a voting system. It takes in the outputs of all the neurons in a layer and decides which neuron should have the most influence on the final output. It does this by converting the outputs into probabilities, with the highest probability representing the most influence.&lt;/p&gt;

&lt;h3&gt;
  
  
  Loss Function
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sOuLnVqS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2Aqv9Ok41WE3LwUgHa_IR4-A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sOuLnVqS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2Aqv9Ok41WE3LwUgHa_IR4-A.png" alt="" width="800" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The loss function is like a scorecard for your ANN. It tells you how well your ANN is doing in solving the problem. Imagine you are playing a game where the goal is to get as many points as possible. The score you get after each round is the loss function. The lower the score, the better the performance of your ANN.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;We have different types of Loss Function and some of them are mentioned here:&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;Mean Squared Error(MSE)&lt;/li&gt;
&lt;li&gt;Root Mean Squared Error(RMSE)&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Mean Squared Error (MSE):
&lt;/h4&gt;

&lt;p&gt;Mean Squared Error (MSE) is the average of the squared differences between the actual output values and the predicted values. It measures the average magnitude of the error in the predictions.&lt;/p&gt;

&lt;p&gt;Mathematically, it is defined as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;MSE = 1/N * Σ(actual — predicted)²,&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;where N is the number of samples and actual and predicted are the actual and predicted values, respectively.&lt;/p&gt;

&lt;p&gt;For example, let’s say you have a model that predicts the height of a person based on their age. You have 5 people, and their actual heights and ages are as follows:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;P1 : Age = 25, Height = 170 cm&lt;/p&gt;

&lt;p&gt;P2: Age = 28, Height = 165 cm&lt;/p&gt;

&lt;p&gt;P3: Age = 30, Height = 160 cm&lt;/p&gt;

&lt;p&gt;P4: Age = 32, Height = 155 cm&lt;/p&gt;

&lt;p&gt;P5: Age = 35, Height = 150 cm&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, let’s say your model predicts the following heights for these people:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;P1: Age = 25, Height = 165 cm&lt;/p&gt;

&lt;p&gt;P2: Age = 28, Height = 170 cm&lt;/p&gt;

&lt;p&gt;P3: Age = 30, Height = 162 cm&lt;/p&gt;

&lt;p&gt;P4: Age = 32, Height = 157 cm&lt;/p&gt;

&lt;p&gt;P5: Age = 35, Height = 153 cm&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The MSE of your model can be calculated as follows:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MSE&lt;/strong&gt; = 1/5 * ( (170–165)² + (165–170)² + (160–162)² + (155–157)² + (150–153)² ) = (⁵² + ⁵² + ²² + ²² + ³²)/5 = 51&lt;/p&gt;

&lt;p&gt;So, the MSE of your model is 51, which means the average magnitude of the error in the predictions is 51 cm².&lt;/p&gt;

&lt;h4&gt;
  
  
  Root Mean Squared Error (RMSE):
&lt;/h4&gt;

&lt;p&gt;Root Mean Squared Error (RMSE) is the square root of the MSE. It gives the error in the same units as the actual and predicted values.&lt;/p&gt;

&lt;p&gt;Mathematically, it is defined as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;RMSE = √(MSE)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Using the same example, the RMSE of your model can be calculated as follows:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RMSE&lt;/strong&gt; = √(51) = 7.14 cm&lt;/p&gt;

&lt;p&gt;So, the RMSE of your model is 7.14 cm, which means the average magnitude of the error in the predictions is 7.14 cm.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tensor:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LlK2p7EW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/792/1%2AWD-5Rg_dQ9ctJnZqi3wcNg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LlK2p7EW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/792/1%2AWD-5Rg_dQ9ctJnZqi3wcNg.png" alt="" width="792" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A tensor is a mathematical object that represents data. It’s like a multi-dimensional array, but more general. Think of it like a cube made of smaller cubes. The smaller cubes are like individual pieces of data, and the bigger cube is like the tensor that holds all of them together. Tensors are used in many areas of machine learning, but especially in deep learning, where they are used to store and manipulate large amounts of data.&lt;/p&gt;

&lt;p&gt;Example: Let’s say you have data about height and weight of 10 people. You can represent this data as a 2-dimensional tensor, where each row represents the height and weight of a single person.&lt;/p&gt;

&lt;h3&gt;
  
  
  Artificial Neural Network (ANN):
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--50EWMDyt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/343/1%2AWObrDLsglumg4CjMHfe0Rw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--50EWMDyt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/343/1%2AWObrDLsglumg4CjMHfe0Rw.png" alt="" width="343" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Artificial Neural Network (ANN) is a mathematical model that is inspired by the structure and function of the human brain. ANN consists of interconnected nodes, also known as artificial neurons, that process information. Each neuron receives inputs, performs a mathematical operation, and generates an output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Imagine you’re trying to identify whether a fruit is an apple or an orange based on its color and shape. You might start by asking a few questions: “Is the fruit round?” and “Is the fruit red?” Based on the answers to these questions, you would be able to determine whether the fruit is an apple or an orange.&lt;/p&gt;

&lt;h3&gt;
  
  
  Forward Propagation:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KPpjW2xd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/626/1%2APdXwOzh8TYgU0rhf3jZesg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KPpjW2xd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/626/1%2APdXwOzh8TYgU0rhf3jZesg.png" alt="" width="626" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Forward Propagation is a process in deep learning where input data is passed through the neural network layers to generate the output. The input is multiplied with the weights of each layer, and the result is passed through the activation function to produce the output. This output becomes the input for the next layer until the final layer produces the final output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Imagine you have a math problem where you have to find the answer by solving multiple steps. Forward propagation is like solving those steps one by one and passing the results to the next step. This continues until the final step where we get the answer.&lt;/p&gt;

&lt;p&gt;In the same way, in a neural network, forward propagation is the process of passing input data through the network, layer by layer, until the final output is generated. At each layer, the data is transformed based on the weights and biases of the neurons present in that layer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Backpropagation
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SyFUYykZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/259/1%2AntOyhrMKNFksrWZUdO5mpA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SyFUYykZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/259/1%2AntOyhrMKNFksrWZUdO5mpA.png" alt="" width="259" height="193"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Backpropagation is an algorithm used to train artificial neural networks (ANNs). It is a supervised learning method that involves the calculation of the gradient of the loss function with respect to the network weights. The goal of backpropagation is to update the weights in a way that reduces the value of the loss function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Think of it as a teacher helping a student learn. The teacher sets a test, the student takes it, and the teacher marks it to see if the student got the answers right or wrong. The teacher then uses this information to guide the student in how to improve for next time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Gradient Descent
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--96T3xRYW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/703/1%2APJ_WxVAhjnfuZhcuAn5NdA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--96T3xRYW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/703/1%2APJ_WxVAhjnfuZhcuAn5NdA.png" alt="" width="703" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Gradient descent is one of the most popular optimizers. It’s a way to update the parameters of the model so that the loss function decreases. The idea is to calculate the gradient of the loss function with respect to the parameters and then take a step in the direction that decreases the loss function. This process is repeated many times until the loss function is as small as possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Suppose you are standing at the top of a hill and trying to reach the bottom. You don’t want to take a straight path because it may not be the quickest or most efficient way down. Instead, you want to take small steps in the direction that will get you to the bottom of the hill the fastest. This is similar to gradient descent. It takes small steps in the direction that will reduce the loss and find the best solution.&lt;/p&gt;

&lt;h3&gt;
  
  
  Epoch:
&lt;/h3&gt;

&lt;p&gt;An epoch in machine learning and artificial neural networks (ANNs) refers to one complete iteration through the entire training dataset. During an epoch, the model processes and uses the information from the training data to update its weights and biases, in order to better predict the outcome for the next iteration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; It’s like taking a test multiple times, each time you take the test, you can learn from your mistakes and do better the next time. In the same way, after each epoch, the model should become better at recognizing patterns in the data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Overfitting &amp;amp; Underfitting:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aEbX-hEY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/425/1%2AO3vmE-8G73rhrQLDwhTm7Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aEbX-hEY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/425/1%2AO3vmE-8G73rhrQLDwhTm7Q.png" alt="" width="425" height="197"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Overfitting:
&lt;/h4&gt;

&lt;p&gt;Overfitting happens when a model becomes too good at recognizing patterns in the training data and becomes too specific to that data. This means that it won’t perform well on new, unseen data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Imagine a child who has memorized all the answers to a test, but doesn’t really understand the concepts. This child will perform poorly on a similar test with different questions.&lt;/p&gt;

&lt;h4&gt;
  
  
  Underfitting:
&lt;/h4&gt;

&lt;p&gt;Underfitting is the opposite of overfitting. It occurs when a model is too simple and doesn’t have enough capacity to learn the patterns in the data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; A child who doesn’t study enough for a test and doesn’t know the answers. This child will perform poorly on the test even if the questions are the same as the ones they have seen before.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Just a Quick Reminder&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;: Feel free to follow&lt;/em&gt; &lt;a href="https://medium.com/u/5e486906a837"&gt;&lt;strong&gt;&lt;em&gt;Aspersh Upadhyay&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;em&gt;for more such interesting topics. If you want free learning resources related to Data Science and related field. Join our Telegram Channel&lt;/em&gt; &lt;a href="http://bit.ly/bitsofds"&gt;&lt;strong&gt;&lt;em&gt;Bit of Data Science&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Cross-Validation:
&lt;/h3&gt;

&lt;p&gt;Cross-validation is a technique used in machine learning to assess how well a model will perform on unseen data. The idea is to divide the data into two parts: a training set and a validation set. The model is trained on the training set and then evaluated on the validation set. This process is repeated multiple times with different parts of the data being used as the validation set each time. The goal is to see if the model is overfitting or underfitting, and to get a better idea of how it will perform on new, unseen data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt; : Suppose you are a teacher and you have a group of 100 students and you want to test how well they know their multiplication tables. You can divide the students into two groups of 50 each. The first group of 50 students is used to train the model, while the second group of 50 students is used to validate it. You repeat this process several times, each time using a different set of 50 students for validation. This way, you get a good idea of how well the students know their multiplication tables, without having to test all 100 of them at once.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hyperparameter Tuning:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3YCQmEzf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/455/1%2ADdQInXDKBGKp8WbInKXEzA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3YCQmEzf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/455/1%2ADdQInXDKBGKp8WbInKXEzA.png" alt="" width="455" height="238"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hyperparameter tuning is the process of selecting the best set of hyperparameters for a machine learning model. Hyperparameters are parameters that are set before training a model and can’t be learned from the data. Examples of hyperparameters include the learning rate, the number of hidden layers in a neural network, or the number of trees in a random forest. The goal of hyperparameter tuning is to find the set of hyperparameters that lead to the best performance on a validation set.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt; : Let’s say you have a recipe for baking a cake. The ingredients in the recipe are like the hyperparameters of a machine learning model. You can change the ingredients in the recipe to see how it affects the taste of the cake. For example, you can try adding more sugar or less flour to see what happens. This is like hyperparameter tuning in machine learning, where you try different combinations of hyperparameters to see which one works best.&lt;/p&gt;

&lt;h3&gt;
  
  
  Convolutional Neural Network (CNN):
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1AzTyZmN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/869/1%2AzsDqbIy4z82O3aixhShMOw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1AzTyZmN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/869/1%2AzsDqbIy4z82O3aixhShMOw.png" alt="" width="800" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A Convolutional Neural Network is a type of artificial neural network that is especially good at analyzing images and videos. It uses a mathematical operation called convolution to scan the image and identify patterns, like shapes or edges.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Think of it like a detective who is looking for clues in a picture, but instead of looking one pixel at a time, the CNN looks at multiple pixels at once to find patterns.&lt;/p&gt;

&lt;h3&gt;
  
  
  Batch Normalization:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Pub5O_Od--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/898/0%2Ank1m6ZuPXs8TNapk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Pub5O_Od--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/898/0%2Ank1m6ZuPXs8TNapk.png" alt="Batch Normalization" width="800" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Batch normalization (BN) is a technique for improving the stability and speed of training deep neural networks. It works by normalizing the activations of neurons in a layer, which helps to make sure that they are all about the same scale. This can help to prevent the vanishing and exploding gradient problems, and it can also make the training process more efficient.&lt;/p&gt;

&lt;p&gt;BN is typically implemented as a layer in a neural network. The layer takes the activations from the previous layer as input, and it normalizes them using the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Calculate the mean and standard deviation of the activations.&lt;/li&gt;
&lt;li&gt;Subtract the mean from each activation.&lt;/li&gt;
&lt;li&gt;Divide each activation by the standard deviation.&lt;/li&gt;
&lt;li&gt;Optionally, scale and shift the activations using learnable parameters.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Scenario to use Batch Normalization:
&lt;/h4&gt;

&lt;p&gt;Assume that you have a neural network with two layers. The first layer has 100 neurons, and the second layer has 10 neurons. The activations of the neurons in the first layer are all over the place. Some of them are very large, and some of them are very small. This can make it difficult for the network to learn, because the gradient of the loss function can be very large or very small, which can make it difficult for the network to find the optimal weights.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dropout:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5MCh8jL2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/413/1%2Azv-MRwetqZr5Rf-Bw8-0hQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5MCh8jL2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/413/1%2Azv-MRwetqZr5Rf-Bw8-0hQ.png" alt="" width="413" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dropout is a technique used to prevent overfitting in deep learning models. It works by randomly dropping out some of the neurons (or brain cells) during each epoch. This forces the model to learn multiple different representations of the data, which helps to prevent it from becoming too specific to the training data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Having multiple people trying to solve the same problem, each person will come up with a different solution, and by combining their solutions, you get a better result.&lt;/p&gt;

&lt;h3&gt;
  
  
  Recurrent Neural Network (RNN):
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--V70HIde3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/163/1%2AyRAspZAAZmS5s25_aotIcQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--V70HIde3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/163/1%2AyRAspZAAZmS5s25_aotIcQ.png" alt="" width="163" height="151"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A Recurrent Neural Network is a type of neural network that is used for processing sequences of data. The main idea behind RNNs is to use the same weights for processing all elements in a sequence, so that the network can retain information about the sequence elements processed so far. An RNN can be used for tasks such as language translation, speech recognition, and text generation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Long Short-Term Memory (LSTM):
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QhBdj7ht--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/299/1%2A8U9gX4EKGOltWONmNCC-pQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QhBdj7ht--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/299/1%2A8U9gX4EKGOltWONmNCC-pQ.png" alt="" width="299" height="169"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Image Source: Towards AI&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;LSTM is a type of Recurrent Neural Network that is designed to handle the vanishing gradient problem. The vanishing gradient problem occurs when training an RNN and the gradients of the loss with respect to the weights become very small, making it difficult to update the weights effectively. LSTM solves this problem by using gates to control the flow of information and gradients through the network.&lt;/p&gt;

&lt;h3&gt;
  
  
  Transfer Learning:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sZ64ctMw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/515/1%2AwFXz1drLk64dQAoaqTBa6Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sZ64ctMw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/515/1%2AwFXz1drLk64dQAoaqTBa6Q.png" alt="" width="515" height="299"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Image source: TOPBOTS&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Transfer learning is a technique in deep learning where a pre-trained neural network model is fine-tuned for a different but related task. For example, a pre-trained image classification model can be fine-tuned for object detection or segmentation. Transfer learning allows for faster training and better performance compared to training a model from scratch.&lt;/p&gt;

&lt;h3&gt;
  
  
  Autoencoder:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mLI9JFd4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/276/1%2AiRtZ6lCHNYcWV5SgGofA2A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mLI9JFd4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/276/1%2AiRtZ6lCHNYcWV5SgGofA2A.png" alt="" width="276" height="273"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Image source: V7 Labs&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;An Autoencoder is a type of neural network that is used for unsupervised learning. The main idea behind Autoencoders is to learn a compact representation of the input data and then use this representation to reconstruct the input data. Autoencoders can be used for tasks such as dimensionality reduction and anomaly detection.&lt;/p&gt;

&lt;h3&gt;
  
  
  Generative Adversarial Network (GAN):
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nHdXVzX2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/818/1%2ACmtgv6cWsSKHF8MxswLkVw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nHdXVzX2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/818/1%2ACmtgv6cWsSKHF8MxswLkVw.png" alt="" width="800" height="364"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Image source: Google ML Course&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A Generative Adversarial Network is a type of neural network that is used for generative modeling. The main idea behind GANs is to train two networks, a generator and a discriminator, against each other. The generator tries to generate data that looks similar to the real data, and the discriminator tries to distinguish the generated data from the real data. The goal is to find a balance between the two networks, where the generator generates data that is indistinguishable from the real data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion:
&lt;/h3&gt;

&lt;p&gt;Deep learning is a subfield of machine learning that is inspired by the structure and function of the human brain and uses artificial neural networks (ANNs). In this article, we explored 20 essential deep learning concepts starting from the basics to more advanced topics.&lt;/p&gt;

&lt;p&gt;These concepts include Artificial Neural Network (ANN), Gradient Descent, Activation Functions (Sigmoid, ReLU, SoftMax), Backpropagation, Forward Propagation, Convolutional Neural Network (CNN), Epoch, Overfitting, Batch Normalization, Dropout, Transfer Learning, Generative Adversarial Network (GAN), Autoencoder, Reinforcement Learning, Convolutional Neural Network (CNN), Recurrent Neural Network (RNN), Long Short-Term Memory (LSTM), Generative Adversarial Network (GAN), and Transfer Learning.&lt;/p&gt;

&lt;p&gt;By understanding these concepts, beginners can gain a comprehensive and intuitive understanding of deep learning.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you have any questions regarding the data science field so join the &lt;a href="http://bitsofds.quora.com"&gt;&lt;strong&gt;Bits of Data Science&lt;/strong&gt;&lt;/a&gt; community and ask your question over there and we will find a solution together to resolve the issues.&lt;/p&gt;

&lt;p&gt;Wanna Free Resources for Data Science and Machine Learning Join our &lt;a href="https://bit.ly/bitsofds"&gt;&lt;strong&gt;Telegram Community&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For more exciting insights into the world of data and machine learning, be sure to follow me on &lt;a href="http://medium.com/@aspershupadhyay"&gt;&lt;strong&gt;Medium&lt;/strong&gt;&lt;/a&gt;, &lt;a href="https://hashnode.com/@aspershupadhyay"&gt;&lt;strong&gt;Hashnode&lt;/strong&gt;&lt;/a&gt; and connect with me on &lt;a href="https://www.linkedin.com/in/aspersh-upadhyay/"&gt;&lt;strong&gt;LinkedIn&lt;/strong&gt;&lt;/a&gt;. I publish articles regularly and would love to continue the conversation with you!&lt;/p&gt;

&lt;p&gt;If you want to support me for writing, you can buy me a &lt;a href="https://www.buymeacoffee.com/aspershupadhyay"&gt;&lt;strong&gt;cup of coffee&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;.&lt;/strong&gt; Would be greatly appreciated.&lt;/p&gt;

&lt;p&gt;Happy learning!😀&lt;/p&gt;

</description>
      <category>artificialintelligen</category>
      <category>python</category>
      <category>datascience</category>
      <category>data</category>
    </item>
    <item>
      <title>Data Wrangling like a Pro: 15 Advanced Pandas Functions for Data Analysis</title>
      <dc:creator>Aspersh Upadhyay</dc:creator>
      <pubDate>Sun, 22 Jan 2023 20:04:12 +0000</pubDate>
      <link>https://dev.to/aspershupadhyay/data-wrangling-like-a-pro-15-advanced-pandas-functions-for-data-analysis-53lo</link>
      <guid>https://dev.to/aspershupadhyay/data-wrangling-like-a-pro-15-advanced-pandas-functions-for-data-analysis-53lo</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vu0RVXOY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AZdTXyqFPB-qzEBLciKIogQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vu0RVXOY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AZdTXyqFPB-qzEBLciKIogQ.png" alt="" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Image source: &lt;a href="https://github.com/YueErro/pandas"&gt;https://github.com/YueErro/pandas&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Pandas, the ultimate weapon for every data enthusiast. This powerful library in Python makes data manipulation and exploration effortless and enjoyable. The intuitive syntax and wide range of functions turn raw data into valuable insights that are vital for anyone working with data. Pandas, you make us complete in our data journey.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;lt; — — — — — — — — — — — — — — — &amp;lt;**&amp;gt;— — — — — — — — — — — — — — — —&amp;gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this Article, we’ll take a look at some of the 20 Advanced functions in pandas by using a popular dataset called “Palmer Penguins” and provide examples of how to use them.&lt;/p&gt;
&lt;h3&gt;
  
  
  1. apply()
&lt;/h3&gt;

&lt;p&gt;This function is used to apply a function to each element or row/column of a DataFrame or Series.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pandas as pd
penguins_df = pd.read_csv("penguins.csv") # read_csv is also a function to read csv file
penguins_df["bill_length_mm"] = penguins_df["bill_length_mm"].apply(lambda x: x/10)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---_K46j1i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/702/1%2A-E1Slr5JM4Beso1duizV8g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---_K46j1i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/702/1%2A-E1Slr5JM4Beso1duizV8g.png" alt="Apply() Function" width="702" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. nunique()
&lt;/h3&gt;

&lt;p&gt;This function is used to count the number of unique values in a column of a DataFrame.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;penguins_df["species"].nunique()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this output we have only &lt;strong&gt;3&lt;/strong&gt; unique species&lt;/p&gt;

&lt;h3&gt;
  
  
  3. sort_values()
&lt;/h3&gt;

&lt;p&gt;This function is used to sort a DataFrame by one or more columns in ascending or descending order.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;penguins_df.sort_values("body_mass_g", ascending=False)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dJ0qmZbR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/703/1%2AupaPHiwQ6KHozARXTMdV3Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dJ0qmZbR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/703/1%2AupaPHiwQ6KHozARXTMdV3Q.png" alt="" width="703" height="185"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. rename()
&lt;/h3&gt;

&lt;p&gt;This function is used to change the column names of a DataFrame.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;penguins_df = penguins_df.rename(columns={"species":"penguin_species"})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--P2KqBOkf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/756/1%2AZ2M822zpiscuMfHrq7eGVw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P2KqBOkf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/756/1%2AZ2M822zpiscuMfHrq7eGVw.png" alt="" width="756" height="160"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5 . groupby()
&lt;/h3&gt;

&lt;p&gt;This function is used to group data in a DataFrame by one or more columns, and then perform calculations on the grouped data. This is a powerful function that is often used for data aggregation and analysis.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;grouped_df = penguins_df.groupby("species").mean()
grouped_df # groups data by species and calculate the mean for each group
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lC0mxZzh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/595/1%2AlvAYCtCt05vpLs_3SN3Zhg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lC0mxZzh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/595/1%2AlvAYCtCt05vpLs_3SN3Zhg.png" alt="" width="595" height="164"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  6. query()
&lt;/h3&gt;

&lt;p&gt;This function is used to filter rows of a DataFrame based on a query string.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Adelie_penguins = penguins_df.query('species == "Adelie"')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9ky4hf3Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/692/1%2AhYO94sYcsiVXvcFzXFv_Jw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9ky4hf3Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/692/1%2AhYO94sYcsiVXvcFzXFv_Jw.png" alt="" width="692" height="178"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  7. melt()
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;melted_df = penguins_df.melt(id_vars=["species"], value_vars=["bill_length_mm", "bill_depth_mm"])
melted_df
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z3pumNG8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/250/1%2A1D107zboUikzOI-iJBfzDw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z3pumNG8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/250/1%2A1D107zboUikzOI-iJBfzDw.png" alt="" width="250" height="176"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  8. crosstab()
&lt;/h3&gt;

&lt;p&gt;This function is used to create a cross-tabulation of two or more columns in a DataFrame. It’s useful for analyzing the relationship between two categorical variables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;crosstab = pd.crosstab(penguins_df['species'], penguins_df['sex'])
crosstab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MjkZA4H8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/177/1%2AM1sn0buLwSUV5hAtPC6wOQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MjkZA4H8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/177/1%2AM1sn0buLwSUV5hAtPC6wOQ.png" alt="" width="177" height="159"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  9. pivot_table()
&lt;/h3&gt;

&lt;p&gt;This function is used to create a pivot table from a DataFrame. A pivot table is a summary of data grouped by one or more columns, and it’s useful for data exploration and analysis.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pivot_df = penguins_df.pivot_table(index='species', columns='sex', values='bill_length_mm', aggfunc='mean')
pivot_df # create a pivot table with the mean of bill_length_mm grouped by species and sex
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XFkZQsyk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/220/1%2AbJG7PqdC-dTptFksHUonyA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XFkZQsyk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/220/1%2AbJG7PqdC-dTptFksHUonyA.png" alt="" width="220" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  10. iloc() and loc()
&lt;/h3&gt;

&lt;p&gt;These functions are used to select rows and columns from a DataFrame by index or label. The &lt;strong&gt;iloc&lt;/strong&gt; function is used to select rows and columns by integer-based indexing, while the &lt;strong&gt;loc&lt;/strong&gt; function is used to select rows and columns by label-based indexing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;penguins_df.iloc[0, 0] # selects the first element in the first row
penguins_df.loc[0, "species"] # selects the element in the first row and species column 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both iloc() and loc() output is &lt;strong&gt;“Adelie”.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  11. cut()
&lt;/h3&gt;

&lt;p&gt;This function is used to bin continuous data into discrete intervals, it’s useful for data exploration and visualization.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;penguins_df['body_mass_g_binned'] = pd.cut(penguins_df['body_mass_g'], bins=np.linspace(0, 6000, num=6))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fRoHHXgq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/848/1%2ArEkA8Gnkjq-KpdXEXYsWWg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fRoHHXgq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/848/1%2ArEkA8Gnkjq-KpdXEXYsWWg.png" alt="" width="800" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  12. isin()
&lt;/h3&gt;

&lt;p&gt;This function is used to filter DataFrame by matching the values against a list of values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;species_list = ['Adelie', 'Chinstrap']
penguins_df = penguins_df[penguins_df['species'].isin(species_list)]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O7hGWBj0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/704/1%2AG6ATD8b8zoinR9XzyW88lw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O7hGWBj0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/704/1%2AG6ATD8b8zoinR9XzyW88lw.png" alt="" width="704" height="181"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  13. value_counts()
&lt;/h3&gt;

&lt;p&gt;This function is used to count the number of occurrences of each unique value in a column of a DataFrame.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;species_count = penguins_df['species'].value_counts()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--P2hBbBKI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/287/1%2A8t_1kIsaGOzj7NvLYu9Q9w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P2hBbBKI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/287/1%2A8t_1kIsaGOzj7NvLYu9Q9w.png" alt="" width="287" height="110"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  14. drop()
&lt;/h3&gt;

&lt;p&gt;This function is used to drop one or more columns or rows from a DataFrame.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;penguins_df = penguins_df.drop("species", axis=1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XbQXgeuy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/633/1%2AfPhfSPpcaS6cdy1fueD-yQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XbQXgeuy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/633/1%2AfPhfSPpcaS6cdy1fueD-yQ.png" alt="" width="633" height="188"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  15 . rolling()
&lt;/h3&gt;

&lt;p&gt;This function is used to create a rolling window of a certain size on a DataFrame or Series, allowing for the calculation of a statistic for each window.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;penguins_df["rolling_mean_bill_length"] = penguins_df["bill_length_mm"].rolling(window=3).mean()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--slWnOQ8K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/869/1%2AXgUs5Gc2gUdQ_3OKMZIQxA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--slWnOQ8K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/869/1%2AXgUs5Gc2gUdQ_3OKMZIQxA.png" alt="" width="800" height="175"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These are some of the most &lt;strong&gt;Advanced&lt;/strong&gt; used functions in pandas and examples of how to use them. These functions are powerful tools for data manipulation and analysis. These Function always used by &lt;strong&gt;Data Scientist&lt;/strong&gt;  , &lt;strong&gt;Data Analysts&lt;/strong&gt; and many &lt;strong&gt;Data Geeks&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>python</category>
      <category>datascience</category>
      <category>pandas</category>
    </item>
    <item>
      <title>Exploring and analyzing large datasets with Python and Pandas</title>
      <dc:creator>Aspersh Upadhyay</dc:creator>
      <pubDate>Sat, 21 Jan 2023 13:13:37 +0000</pubDate>
      <link>https://dev.to/aspershupadhyay/exploring-and-analyzing-large-datasets-with-python-and-pandas-3gin</link>
      <guid>https://dev.to/aspershupadhyay/exploring-and-analyzing-large-datasets-with-python-and-pandas-3gin</guid>
      <description>&lt;p&gt;Pandas makes our data analysis journey easier&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GRGSa1Cz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/663/1%2A9EFB7f3GBk1NIGXKKkc0Sw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GRGSa1Cz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/663/1%2A9EFB7f3GBk1NIGXKKkc0Sw.png" alt="" width="663" height="375"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Image source: realpython.comhttps://realpython.com/lessons/sorting-data-python-pandas-overview/&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In today’s world, data is being generated at an unprecedented rate, and the ability to effectively analyze and understand this data is critical for &lt;strong&gt;making informed decisions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this blog post, we will explore how to use the Python &lt;strong&gt;Pandas&lt;/strong&gt; library to analyze large datasets. We will be using the &lt;strong&gt;Titanic&lt;/strong&gt; dataset, a well-known dataset that contains information about the passengers on the &lt;strong&gt;Titanic ship&lt;/strong&gt; that &lt;strong&gt;sank in 1912&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Pandas&lt;/strong&gt; library is a powerful tool for data manipulation and analysis. It provides a data structure called a DataFrame, which allows us to manipulate and analyze large datasets with ease. In this post, we will go over some basic operations that can be performed on a DataFrame and how they can be used to analyze the Titanic dataset.&lt;/p&gt;

&lt;p&gt;First, we will start by importing the necessary libraries and loading the Titanic dataset into a DataFrame.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# load required library 
import pandas as pd

# load the dataset
df = pd.read_csv("https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once we have the dataset loaded into a DataFrame, we can start exploring the data. One of the first things we might want to do is to get a general overview of the data. We can use the head() method to display the first few rows of the data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Display the first few rows of the data
df.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QixvGcHx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2Au6ex1T77_IEUBueTJWJoWg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QixvGcHx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2Au6ex1T77_IEUBueTJWJoWg.png" alt="" width="800" height="138"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will give us a general idea of the structure of the data and the type of information that is available. We can also use the describe() method to get some basic statistics about the numerical columns in the data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Get some basic statistics about the data
df.describe()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Cg7H4Q09--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/667/1%2AWKNkRaJFnLgHpnDAhpIMCQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Cg7H4Q09--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/667/1%2AWKNkRaJFnLgHpnDAhpIMCQ.png" alt="" width="667" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can also use the info() method to get information about the columns in the data, such as the data type and number of non-null values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Get information about the columns in the data
df.info()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--okrJykxJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/388/1%2Aq3YxwAfiRCFDjcemBXlaVA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--okrJykxJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/388/1%2Aq3YxwAfiRCFDjcemBXlaVA.png" alt="" width="388" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we can start analyzing the data in more detail. One way to do this is by using the groupby() method to group the data by a certain column and then applying a function to the groups. For example, we can group the data by the 'Survived' column and then calculate the mean of the 'Age' column for each group.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Group the data by the 'Survived' column and calculate the mean of the 'Age' column
df.groupby("Survived")["Age"].mean()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qUI549Sf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/232/1%2A-Fk-79PPBouJCRlTqyleyw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qUI549Sf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/232/1%2A-Fk-79PPBouJCRlTqyleyw.png" alt="" width="232" height="89"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can also use the pivot_table() method to create a pivot table of the data. This is a useful way to quickly summarize the data and see the relationship between different columns.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Create a pivot table of the data
pd.pivot_table(df, values='Age', index='Pclass', columns='Survived', aggfunc='mean')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WyNR79mq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/236/1%2AOKVd_LFlMtl24GOliwyrNw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WyNR79mq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/236/1%2AOKVd_LFlMtl24GOliwyrNw.png" alt="" width="236" height="147"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another way to analyze and visualize the data is by using data visualization libraries like Matplotlib and Seaborn. For instance, we can use the matplotlib.pyplot module to create a histogram of the 'Age' column.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import matplotlib.pyplot as plt

# Create a histogram of the 'Age' column
plt.hist(df["Age"])
plt.xlabel('Age')
plt.ylabel('Frequency')
plt.title('Histogram of Age')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6DocESYi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/598/1%2AqfuXiDlOrbN3CfOoTlqx8g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6DocESYi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/598/1%2AqfuXiDlOrbN3CfOoTlqx8g.png" alt="" width="598" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similarly, we can use the seaborn.countplot() function to create a barplot of the number of passengers who survived and did not survive.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import seaborn as sns

# Create a bar plot of the number of passengers who survived and did not survive
sns.countplot(x="Survived", data=df)
plt.xlabel('Survived')
plt.ylabel('Count')
plt.title('Bar Plot of Survivors')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pfhocN_---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/592/1%2ACQa8-k2fa50iolxZ03a-VA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pfhocN_---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/592/1%2ACQa8-k2fa50iolxZ03a-VA.png" alt="" width="592" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can also use the seaborn.boxplot() function to create a box plot of the 'Age' column grouped by the 'Survived' column. This can give us a better understanding of the distribution of ages among survivors and non-survivors.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Create a box plot of the 'Age' column grouped by the 'Survived' column
sns.boxplot(x="Survived", y="Age", data=df)
plt.xlabel('Survived')
plt.ylabel('Age')
plt.title('Box Plot of Age by Survival')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ybTzAFIB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/598/1%2ADlZzA3obiXfhnd2gPWsjiA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ybTzAFIB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/598/1%2ADlZzA3obiXfhnd2gPWsjiA.png" alt="" width="598" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this blog post, we have covered some basic operations that can be performed on a DataFrame using the Python Pandas library and how to use Python’s visualization library to analyze the titanic dataset. We have seen how to use Pandas to explore and analyze large datasets. With the help of Pandas, it becomes much easier to manipulate and visualize large datasets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt; : It’s important to note that this is just a small subset of all the analysis that we can do with the titanic dataset, there’s much more to be discovered and visualized.&lt;/p&gt;

</description>
      <category>data</category>
      <category>datascience</category>
      <category>python</category>
      <category>datavisualization</category>
    </item>
  </channel>
</rss>
