<?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: Rajasekaran Palraj</title>
    <description>The latest articles on DEV Community by Rajasekaran Palraj (@raja_sekaran_a1319259e6f1).</description>
    <link>https://dev.to/raja_sekaran_a1319259e6f1</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3313549%2F652e5000-bb55-4b16-a92c-e2a33e697cc3.jpg</url>
      <title>DEV Community: Rajasekaran Palraj</title>
      <link>https://dev.to/raja_sekaran_a1319259e6f1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/raja_sekaran_a1319259e6f1"/>
    <language>en</language>
    <item>
      <title>Data Analysis with Excel - Notes</title>
      <dc:creator>Rajasekaran Palraj</dc:creator>
      <pubDate>Sat, 29 Nov 2025 05:05:54 +0000</pubDate>
      <link>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-with-excel-notes-2n14</link>
      <guid>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-with-excel-notes-2n14</guid>
      <description>&lt;p&gt;Array Functions:&lt;/p&gt;

&lt;p&gt;Modern Dynamic Array vs Classic Array &lt;/p&gt;

&lt;p&gt;unique&lt;br&gt;
Sort(R2#)&lt;/p&gt;

&lt;p&gt;Lookup&lt;/p&gt;

&lt;p&gt;VLookup&lt;br&gt;
Hlookup&lt;br&gt;
XLookup&lt;/p&gt;

&lt;p&gt;Unique:&lt;br&gt;
=UNIQUE(A:A,FALSE,FALSE) - to get unique values&lt;/p&gt;

&lt;p&gt;=UNIQUE(A:A,FALSE,TRUE) - to get values exist only one&lt;/p&gt;

&lt;p&gt;Duplicate&lt;br&gt;
=UNIQUE(FILTER(A2:A100, COUNTIF(A2:A100, A2:A100)&amp;gt;1))&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quick Analysis&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Quick Analysis tool makes it possible to analyze your data quickly and easily using different Excel tools.&lt;/p&gt;

&lt;p&gt;You can use Quick Analysis with a range or a table of data. To access Quick Access tool, select the cells that contain the data you want to analyze. The Quick Analysis tool buttonQuick Analysis Tool Button&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu4lbklf11w58t5d68u7o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu4lbklf11w58t5d68u7o.png" alt=" " width="24" height="24"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frvhnsjje9ntobjtjhskp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frvhnsjje9ntobjtjhskp.png" alt=" " width="378" height="248"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Formatting&lt;/strong&gt;&lt;br&gt;
Charts&lt;br&gt;
Total&lt;br&gt;
Tables&lt;br&gt;
Sparklines&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lookups&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Find values in a range of data - &lt;strong&gt;VLOOKUP and HLOOKUP&lt;/strong&gt;&lt;br&gt;
Obtain a value or the reference to a value from within a table or range - &lt;strong&gt;INDEX&lt;/strong&gt;&lt;br&gt;
Obtain the relative position of a specified item in a range of cells - &lt;strong&gt;MATCH&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Using VLOOKUP Function&lt;br&gt;
The syntax of the VLOOKUP function is&lt;/p&gt;

&lt;p&gt;VLOOKUP (lookup_value, table_array, col_index_num, [range_lookup])&lt;/p&gt;

&lt;p&gt;Using VLOOKUP Function with range_lookup FALSE&lt;br&gt;
_&lt;br&gt;
Use range_lookup  False when data not in order and not matching exact values_&lt;/p&gt;

&lt;p&gt;Using HLOOKUP Function&lt;br&gt;
You can use HLOOKUP function if the data is in rows rather than columns.&lt;/p&gt;

&lt;p&gt;_&lt;br&gt;
Use range_lookup  False when data not in order and not matching exact values_&lt;/p&gt;

&lt;p&gt;Using INDEX Function&lt;br&gt;
When you have an array of data, you can retrieve a value in the array by specifying the row number and column number of that value in the array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pivot Tables:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Data analysis on a large set of data is quite often necessary and important. It involves summarizing the data, obtaining the needed values and presenting the results.&lt;/p&gt;

&lt;p&gt;Excel provides PivotTable to enable you summarize thousands of data values easily and quickly so as to obtain the required results.&lt;/p&gt;

&lt;p&gt;Creating PivotTable&lt;br&gt;
To create PivotTables, ensure the first row has headers.&lt;/p&gt;

&lt;p&gt;Click the table.&lt;br&gt;
Click the INSERT tab on the Ribbon.&lt;br&gt;
Click PivotTable in the Tables group. The PivotTable dialog box appears.&lt;/p&gt;

&lt;p&gt;In the Table / Range Box, type the table name.&lt;br&gt;
Click New Worksheet to tell Excel where to keep the PivotTable.&lt;br&gt;
Click OK.&lt;/p&gt;

&lt;p&gt;Charts:&lt;/p&gt;

&lt;p&gt;Excel charts transform raw data into clear, visual representations, enabling us to analyze trends, compare datasets and communicate insights effectively. Charts visually represent data, making complex information easier to interpret. Different chart types include:&lt;/p&gt;

&lt;p&gt;Column Chart: Compares values across categories.&lt;br&gt;
Bar Chart: Similar to column charts but with horizontal bars.&lt;br&gt;
Line Chart: Displays trends over time.&lt;br&gt;
Pie Chart: Shows proportions of a whole.&lt;br&gt;
Combo Chart: Combines multiple chart types (e.g., column and line).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Creating a Chart in Excel
Follow the steps below to create a chart in Excel:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Step 1: Select the data for which we want to create the chart.&lt;br&gt;
Step 2: Go to Insert tab and Select type of Chart&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Changing the Chart Type
Follow the below steps to change the chart type:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Click on Chart Design&lt;br&gt;
Click on Change Chart Type&lt;br&gt;
Select the type of chart we want&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Customizing the Chart Type
3.1 Switch Row/Column
To switch the rows or columns follow the below steps:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Go to the Design tab in the Ribbon.&lt;br&gt;
Click on Switch Row/Column&lt;/p&gt;

&lt;p&gt;3.2 Legend Position&lt;br&gt;
Follow the below steps to place the legends&lt;/p&gt;

&lt;p&gt;Go to Chart Design in Insert chart&lt;br&gt;
Click on Add Chart Element&lt;br&gt;
Navigate to Legend&lt;br&gt;
Select where we want to place our legends.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Recommendated Charts&lt;/li&gt;
&lt;li&gt;Chart Design 

&lt;ul&gt;
&lt;li&gt;Chart Element to  help show visual indication&lt;/li&gt;
&lt;li&gt;Quick Layout to try different themes&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Line Chart:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Job Title&lt;/li&gt;
&lt;li&gt;Include/Remove Axes From Chart Elements&lt;/li&gt;
&lt;li&gt;Add Trend Line&lt;/li&gt;
&lt;li&gt;we can use Chart Design to change Quick Layout and Chart Elements&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pie chart&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Job no degree mention&lt;/li&gt;
&lt;li&gt;Chart Design -&amp;gt; Quick Chart&lt;/li&gt;
&lt;li&gt;Change Colors from Quick Chart&lt;/li&gt;
&lt;li&gt;Change Font from Format&lt;/li&gt;
&lt;li&gt;Customize percentage - Lable/Number Decimal places&lt;/li&gt;
&lt;li&gt;Change Chart Tiles with valid name&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Bar-Column Chart:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Names are long in column chart&lt;/li&gt;
&lt;li&gt;Not organized&lt;/li&gt;
&lt;li&gt;Sort by Job Count&lt;/li&gt;
&lt;li&gt;Create Bar chart&lt;/li&gt;
&lt;li&gt;Change sort order and create bar chart again&lt;/li&gt;
&lt;li&gt;select chart and right click select data&lt;/li&gt;
&lt;li&gt;Try Change Chart Type&lt;/li&gt;
&lt;li&gt;Add DAta lables to shwow count&lt;/li&gt;
&lt;li&gt;Change number Format by double clicking count&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Scatter Plots&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Salary year avg, salary hour avg&lt;/li&gt;
&lt;li&gt;Select only yearly Median avg and Hourly Median avg&lt;/li&gt;
&lt;li&gt;Click axis and change Axis Option Bounds min/max&lt;/li&gt;
&lt;li&gt;Change Number format&lt;/li&gt;
&lt;li&gt;Enable Axis Titles&lt;/li&gt;
&lt;li&gt;select Axis Tiles, Enter= then select cell which have title name&lt;/li&gt;
&lt;li&gt;Enable Data Labels &lt;/li&gt;
&lt;li&gt;Add values from cell otion from format&lt;/li&gt;
&lt;li&gt;select Range for job names&lt;/li&gt;
&lt;li&gt;Add Trend Lines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Add values in bar chart&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Map Charts&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Job country&lt;/li&gt;
&lt;li&gt;get Job count and Median Salary&lt;/li&gt;
&lt;li&gt;Create Map chart by select job title and Median Salary&lt;/li&gt;
&lt;li&gt;Change Title&lt;/li&gt;
&lt;li&gt;Apply Filter&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Histogram:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Skewed Write Distribution&lt;/li&gt;
&lt;li&gt;Filter --&amp;gt; Number filter --&amp;gt; less than 300000&lt;/li&gt;
&lt;li&gt;Double Click Bar - change bin width&lt;/li&gt;
&lt;li&gt;Change Number Format&lt;/li&gt;
&lt;li&gt;Change Title, Enable Axes Titles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Box &amp;amp; Whiskers Charts&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;To analyse different jobs titles&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select salary and title &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use REcommended chart&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Change Y axis maximum values&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Change Number format&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;change Color&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Change Title&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Spark Lines&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Its Mini Charts&lt;/li&gt;
&lt;li&gt;select data / Insert / sparklines Column&lt;/li&gt;
&lt;li&gt;Add High Point/ Low Point&lt;/li&gt;
&lt;li&gt;Change color for High Point&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Dashboard&lt;/p&gt;

&lt;p&gt;Power Query&lt;/p&gt;

&lt;p&gt;it used to copy data from multiple places into excel or powerBi (ETL)&lt;/p&gt;

&lt;p&gt;Combine Quereis (Merge and Append)&lt;/p&gt;

&lt;p&gt;M Language&lt;/p&gt;

&lt;p&gt;Power Pivot&lt;/p&gt;

&lt;p&gt;DAX&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/lukebarousse/Excel_Data_Analytics_Course/tree/main" rel="noopener noreferrer"&gt;https://github.com/lukebarousse/Excel_Data_Analytics_Course/tree/main&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Data Analysis - Matplot Lib - Notes</title>
      <dc:creator>Rajasekaran Palraj</dc:creator>
      <pubDate>Wed, 19 Nov 2025 02:34:27 +0000</pubDate>
      <link>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-matplot-lib-notes-5851</link>
      <guid>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-matplot-lib-notes-5851</guid>
      <description>&lt;p&gt;Matplotlib is a powerful and versatile open-source plotting library for Python, designed to help users visualize data in a variety of formats. Developed by John D. Hunter in 2003, it enables users to graphically represent data, facilitating easier analysis and understanding. If you want to convert your boring data into interactive plots and graphs, Matplotlib is the tool for you.&lt;/p&gt;

&lt;p&gt;Components or Parts of Matplotlib Figure&lt;br&gt;
Anatomy of a Matplotlib Plot: This section dives into the key components of a Matplotlib plot, including figures, axes, titles, and legends, essential for effective data visualization.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1us42w9y69gdibuoxhzj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1us42w9y69gdibuoxhzj.png" alt=" " width="800" height="571"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The parts of a Matplotlib figure include (as shown in the figure above):&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Figure&lt;/strong&gt;: The overarching container that holds all plot elements, acting as the canvas for visualizations.&lt;br&gt;
&lt;strong&gt;Axes&lt;/strong&gt;: The areas within the figure where data is plotted; each figure can contain multiple axes.&lt;br&gt;
&lt;strong&gt;Axis&lt;/strong&gt;: Represents the x-axis and y-axis, defining limits, tick locations, and labels for data interpretation.&lt;br&gt;
&lt;strong&gt;Lines and Markers&lt;/strong&gt;: Lines connect data points to show trends, while markers denote individual data points in plots like scatter plots.&lt;br&gt;
&lt;strong&gt;Title and Labels&lt;/strong&gt;: The title provides context for the plot, while axis labels describe what data is being represented on each axis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Matplotlib Pyplot&lt;/strong&gt;&lt;br&gt;
Pyplot is a module within Matplotlib that provides a MATLAB-like interface for making plots. It simplifies the process of adding plot elements such as lines, images, and text to the axes of the current figure. Steps to Use Pyplot:&lt;/p&gt;

&lt;p&gt;Import Matplotlib: Start by importing matplotlib.pyplot as plt.&lt;br&gt;
Create Data: Prepare your data in the form of lists or arrays.&lt;br&gt;
Plot Data: Use plt.plot() to create the plot.&lt;br&gt;
Customize Plot: Add titles, labels, and other elements using methods like plt.title(), plt.xlabel(), and plt.ylabel().&lt;br&gt;
Display Plot: Use plt.show() to display the plot.&lt;br&gt;
Let's visualize a basic plot, and understand basic components of matplotlib figure:&lt;/p&gt;

&lt;p&gt;import matplotlib.pyplot as plt&lt;br&gt;
​&lt;br&gt;
x = [0, 2, 4, 6, 8]&lt;br&gt;
y = [0, 4, 16, 36, 64]&lt;br&gt;
​&lt;br&gt;
fig, ax = plt.subplots()&lt;br&gt;&lt;br&gt;
ax.plot(x, y, marker='o', label="Data Points")&lt;br&gt;
​&lt;br&gt;
ax.set_title("Basic Components of Matplotlib Figure")&lt;br&gt;
ax.set_xlabel("X-Axis") &lt;br&gt;
ax.set_ylabel("Y-Axis")&lt;br&gt;&lt;br&gt;
​&lt;br&gt;
​&lt;br&gt;
plt.show()&lt;br&gt;
Output:&lt;/p&gt;

&lt;p&gt;Basic Components of matplotlib figure&lt;br&gt;
Different Types of Plots in Matplotlib&lt;br&gt;
Matplotlib offers a wide range of plot types to suit various data visualization needs. Here are some of the most commonly used types of plots in Matplotlib:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Line Graph&lt;/li&gt;
&lt;li&gt;Bar Chart&lt;/li&gt;
&lt;li&gt;Histogram&lt;/li&gt;
&lt;li&gt;Scatter Plot&lt;/li&gt;
&lt;li&gt;Pie Chart&lt;/li&gt;
&lt;li&gt;3D Plot
and many more..&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Bar chart and Pie chart&lt;br&gt;
For learning about the different types of plots in Matplotlib, please read Types of Plots in Matplotlib. &lt;/p&gt;

&lt;p&gt;Key Features of Matplotlib&lt;br&gt;
Versatile Plotting: Create a wide variety of visualizations, including line plots, scatter plots, bar charts, and histograms.&lt;br&gt;
Extensive Customization: Control every aspect of your plots, from colors and markers to labels and annotations.&lt;br&gt;
Seamless Integration with NumPy: Effortlessly plot data arrays directly, enhancing data manipulation capabilities.&lt;br&gt;
High-Quality Graphics: Generate publication-ready plots with precise control over aesthetics.&lt;br&gt;
Cross-Platform Compatibility: Use Matplotlib on Windows, macOS, and Linux without issues.&lt;br&gt;
Interactive Visualizations: Engage with your data dynamically through interactive plotting features.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Matplotlib Simple Line Plot&lt;/strong&gt;&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
import numpy as np

x = np.array([1, 2, 3, 4])  # X-axis 
y = x*2  # Y-axis

plt.plot(x, y)  
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





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

x = np.array([1, 2, 3, 4])
y = x*2

plt.plot(x, y)
plt.xlabel("X-axis")        # Label for the X-axis
plt.ylabel("Y-axis")        # Label for the Y-axis
plt.title("Any suitable title")  # Chart title
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Line Chart with Annotations&lt;/strong&gt;&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

x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]

plt.figure(figsize=(8, 6))
plt.plot(x, y, marker='o', linestyle='-')

# Add annotations
for i, (xi, yi) in enumerate(zip(x, y)):
    plt.annotate(f'({xi}, {yi})', (xi, yi), textcoords="offset points", xytext=(0, 10), ha='center')

plt.title('Line Chart with Annotations')
plt.xlabel('X-axis Label')
plt.ylabel('Y-axis Label')

plt.grid(True)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*&lt;em&gt;Multiple Line Charts Using Matplotlib *&lt;/em&gt;&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
import numpy as np


x = np.array([1, 2, 3, 4])
y = x*2

plt.plot(x, y)
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.title("Any suitable title")
plt.show()  # show first chart

plt.figure()
x1 = [2, 4, 6, 8]
y1 = [3, 5, 7, 9]
plt.plot(x1, y1, '-.')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Multiple Plots on the Same Axis&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
import numpy as np

x = np.array([1, 2, 3, 4])
y = x*2

# first plot with X and Y data
plt.plot(x, y)

x1 = [2, 4, 6, 8]
y1 = [3, 5, 7, 9]

# second plot with x1 and y1 data
plt.plot(x1, y1, '-.')

plt.xlabel("X-axis data")
plt.ylabel("Y-axis data")
plt.title('multiple plots')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Fill the Area Between Two Lines&lt;/strong&gt;&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
import numpy as np

x = np.array([1, 2, 3, 4])
y = x*2

plt.plot(x, y)

x1 = [2, 4, 6, 8]
y1 = [3, 5, 7, 9]

plt.plot(x, y1, '-.')
plt.xlabel("X-axis data")
plt.ylabel("Y-axis data")
plt.title('multiple plots')

plt.fill_between(x, y, y1, color='green', alpha=0.5)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Bar Plot&lt;/strong&gt;&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
import numpy as np

fruits = ['Apples', 'Bananas', 'Cherries', 'Dates']
sales = [400, 350, 300, 450]

plt.bar(fruits, sales)
plt.title('Fruit Sales')
plt.xlabel('Fruits')
plt.ylabel('Sales')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Customizing Bar Colors&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
import numpy as np

fruits = ['Apples', 'Bananas', 'Cherries', 'Dates']
sales = [400, 350, 300, 450]

plt.bar(fruits, sales, color='violet')
plt.title('Fruit Sales')
plt.xlabel('Fruits')
plt.ylabel('Sales')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Creating Horizontal Bar Plots&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
import numpy as np

fruits = ['Apples', 'Bananas', 'Cherries', 'Dates']
sales = [400, 350, 300, 450]

plt.barh(fruits, sales)

plt.title('Fruit Sales')
plt.xlabel('Fruits')
plt.ylabel('Sales')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Adjusting Bar width&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
import numpy as np

fruits = ['Apples', 'Bananas', 'Cherries', 'Dates']
sales = [400, 350, 300, 450]

plt.bar(fruits, sales, width=0.3)
plt.title('Fruit Sales')
plt.xlabel('Fruits')
plt.ylabel('Sales')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Multiple bar plots&lt;br&gt;
&lt;/p&gt;

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

barWidth = 0.25
fig = plt.subplots(figsize =(12, 8)) 

IT = [12, 30, 1, 8, 22] 
ECE = [28, 6, 16, 5, 10] 
CSE = [29, 3, 24, 25, 17] 

br1 = np.arange(len(IT)) 
br2 = [x + barWidth for x in br1] 
br3 = [x + barWidth for x in br2] 

plt.bar(br1, IT, color ='r', width = barWidth, 
        edgecolor ='grey', label ='IT') 
plt.bar(br2, ECE, color ='g', width = barWidth, 
        edgecolor ='grey', label ='ECE') 
plt.bar(br3, CSE, color ='b', width = barWidth, 
        edgecolor ='grey', label ='CSE') 

plt.xlabel('Branch', fontweight ='bold', fontsize = 15) 
plt.ylabel('Students passed', fontweight ='bold', fontsize = 15) 
plt.xticks([r + barWidth for r in range(len(IT))], 
        ['2015', '2016', '2017', '2018', '2019'])

plt.legend()
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stacked bar chart&lt;br&gt;
&lt;/p&gt;

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

N = 5

boys = (20, 35, 30, 35, 27)
girls = (25, 32, 34, 20, 25)
boyStd = (2, 3, 4, 1, 2)
girlStd = (3, 5, 2, 3, 3)
ind = np.arange(N)   
width = 0.35  

fig = plt.subplots(figsize =(10, 7))
p1 = plt.bar(ind, boys, width, yerr = boyStd)
p2 = plt.bar(ind, girls, width,
             bottom = boys, yerr = girlStd)

plt.ylabel('Contribution')
plt.title('Contribution by the teams')
plt.xticks(ind, ('T1', 'T2', 'T3', 'T4', 'T5'))
plt.yticks(np.arange(0, 81, 10))
plt.legend((p1[0], p2[0]), ('boys', 'girls'))

plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Matplotlib Scatter&lt;/strong&gt;&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
import numpy as np

x = np.array([12, 45, 7, 32, 89, 54, 23, 67, 14, 91])
y = np.array([99, 31, 72, 56, 19, 88, 43, 61, 35, 77])

plt.scatter(x, y)
plt.title("Basic Scatter Plot")
plt.xlabel("X Values")
plt.ylabel("Y Values")
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example 1: In this example, we compare the height and weight of two different groups using different colors 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;x1 = np.array([160, 165, 170, 175, 180, 185, 190, 195, 200, 205])
y1 = np.array([55, 58, 60, 62, 64, 66, 68, 70, 72, 74])

x2 = np.array([150, 155, 160, 165, 170, 175, 180, 195, 200, 205])
y2 = np.array([50, 52, 54, 56, 58, 64, 66, 68, 70, 72])

plt.scatter(x1, y1, color='blue', label='Group 1')
plt.scatter(x2, y2, color='red', label='Group 2')

plt.xlabel('Height (cm)')
plt.ylabel('Weight (kg)')
plt.title('Comparison of Height vs Weight between two groups')
plt.legend()
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example 2: This example demonstrates how to customize a scatter plot using different marker sizes and colors for each point. Transparency and edge colors are also adjusted.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = np.array([3, 12, 9, 20, 5, 18, 22, 11, 27, 16])
y = np.array([95, 55, 63, 77, 89, 50, 41, 70, 58, 83])

a = [20, 50, 100, 200, 500, 1000, 60, 90, 150, 300] # size
b = ['red', 'green', 'blue', 'purple', 'orange', 'black', 'pink', 'brown', 'yellow', 'cyan'] # color

plt.scatter(x, y, s=a, c=b, alpha=0.6, edgecolors='w', linewidths=1)
plt.title("Scatter Plot with Varying Colors and Sizes")
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example 3: This example shows how to create a bubble plot where the size of each point (bubble) represents a variable's magnitude. Edge color and alpha transparency are also used.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = [1, 2, 3, 4, 5]
y = [2, 3, 5, 7, 11]
sizes = [30, 80, 150, 200, 300]  # Bubble sizes

plt.scatter(x, y, s=sizes, alpha=0.5, edgecolors='blue', linewidths=2)
plt.title("Bubble Plot Example")
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example 4: In this example, we map data values to colors using a colormap and add a colorbar. This helps in visualizing a third variable via color intensity.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = np.random.randint(50, 150, 100)
y = np.random.randint(50, 150, 100)
colors = np.random.rand(100)  # Random float values for color mapping
sizes = 20 * np.random.randint(10, 100, 100)

plt.scatter(x, y, c=colors, s=sizes, cmap='viridis', alpha=0.7)
plt.colorbar(label='Color scale')
plt.title("Scatter Plot with Colormap and Colorbar")
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example 5: This final example illustrates how to change the marker style using the marker parameter. Here, triangle markers are used with magenta color.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.scatter(x, y, marker='^', color='magenta', s=100, alpha=0.7)
plt.title("Scatter Plot with Triangle Markers")
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*&lt;em&gt;Plotting Histogram *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Different methods of plotting histogram&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basic Histogram&lt;/li&gt;
&lt;li&gt;Customized Histogram with Density Plot&lt;/li&gt;
&lt;li&gt;Customized Histogram with Watermark&lt;/li&gt;
&lt;li&gt;Multiple Histograms with Subplots&lt;/li&gt;
&lt;li&gt;Stacked Histogram&lt;/li&gt;
&lt;li&gt;2D Histogram (Hexbin Plot)&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Basic Histogram
&lt;/li&gt;
&lt;/ol&gt;

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

# Generate random data for the histogram
data = np.random.randn(1000)

# Plotting a basic histogram
plt.hist(data, bins=30, color='skyblue', edgecolor='black')

# Adding labels and title
plt.xlabel('Values')
plt.ylabel('Frequency')
plt.title('Basic Histogram')

# Display the plot
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Customized Histogram with Density Plot
&lt;/li&gt;
&lt;/ol&gt;

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

# Generate random data for the histogram
data = np.random.randn(1000)

# Creating a customized histogram with a density plot
sns.histplot(data, bins=30, kde=True, color='lightgreen', edgecolor='red')

# Adding labels and title
plt.xlabel('Values')
plt.ylabel('Density')
plt.title('Customized Histogram with Density Plot')

# Display the plot
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Customized Histogram with Watermark
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import matplotlib.pyplot as plt
import numpy as np
from matplotlib import colors
from matplotlib.ticker import PercentFormatter

# Creating dataset
np.random.seed(23685752)
N_points = 10000
n_bins = 20

# Creating distribution
x = np.random.randn(N_points)
y = 0.8 ** x + np.random.randn(N_points) + 25
legend = ['distribution']

# Creating figure and axes
fig, axs = plt.subplots(1, 1, figsize=(10, 7), tight_layout=True)

# Remove axes splines
for s in ['top', 'bottom', 'left', 'right']:
    axs.spines[s].set_visible(False)

# Remove x, y ticks
axs.xaxis.set_ticks_position('none')
axs.yaxis.set_ticks_position('none')

# Add padding between axes and labels
axs.xaxis.set_tick_params(pad=5)
axs.yaxis.set_tick_params(pad=10)

# Add x, y gridlines (updated syntax)
axs.grid(visible=True, color='grey', linestyle='-.', linewidth=0.5, alpha=0.6)

# Add text watermark
fig.text(0.9, 0.15, 'Jeeteshgavande30',
         fontsize=12,
         color='red',
         ha='right',
         va='bottom',
         alpha=0.7)

# Creating histogram
N, bins, patches = axs.hist(x, bins=n_bins)

# Setting color gradient
fracs = ((N ** (1 / 5)) / N.max())
norm = colors.Normalize(fracs.min(), fracs.max())

for thisfrac, thispatch in zip(fracs, patches):
    color = plt.cm.viridis(norm(thisfrac))
    thispatch.set_facecolor(color)

# Adding extra features
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.legend(legend)
plt.title('Customized Histogram with Watermark')

# Show plot
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Multiple Histograms with Subplots
&lt;/li&gt;
&lt;/ol&gt;

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

# Generate random data for multiple histograms
data1 = np.random.randn(1000)
data2 = np.random.normal(loc=3, scale=1, size=1000)

# Creating subplots with multiple histograms
fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(12, 4))

axes[0].hist(data1, bins=30, color='Yellow', edgecolor='black')
axes[0].set_title('Histogram 1')

axes[1].hist(data2, bins=30, color='Pink', edgecolor='black')
axes[1].set_title('Histogram 2')

# Adding labels and title
for ax in axes:
    ax.set_xlabel('Values')
    ax.set_ylabel('Frequency')

# Adjusting layout for better spacing
plt.tight_layout()

# Display the figure
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Stacked Histogram
&lt;/li&gt;
&lt;/ol&gt;

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

# Generate random data for stacked histograms
data1 = np.random.randn(1000)
data2 = np.random.normal(loc=3, scale=1, size=1000)

# Creating a stacked histogram
plt.hist([data1, data2], bins=30, stacked=True, color=['cyan', 'Purple'], edgecolor='black')

# Adding labels and title
plt.xlabel('Values')
plt.ylabel('Frequency')
plt.title('Stacked Histogram')

# Adding legend
plt.legend(['Dataset 1', 'Dataset 2'])

# Display the plot
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;2D Histogram (Hexbin Plot)
&lt;/li&gt;
&lt;/ol&gt;

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

# Generate random 2D data for hexbin plot
x = np.random.randn(1000)
y = 2 * x + np.random.normal(size=1000)

# Creating a 2D histogram (hexbin plot)
plt.hexbin(x, y, gridsize=30, cmap='Blues')

# Adding labels and title
plt.xlabel('X values')
plt.ylabel('Y values')
plt.title('2D Histogram (Hexbin Plot)')

# Adding colorbar
plt.colorbar(label='Counts')

plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pie Chart&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Import libraries
from matplotlib import pyplot as plt
import numpy as np


# Creating dataset
cars = ['AUDI', 'BMW', 'FORD',
        'TESLA', 'JAGUAR', 'MERCEDES']

data = [23, 17, 35, 29, 12, 41]

# Creating plot
fig = plt.figure(figsize=(10, 7))
plt.pie(data, labels=cars)

# show plot
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Customizing Pie Charts&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;startangle: This attribute allows you to rotate the pie chart in Python counterclockwise around the x-axis by the specified degrees.. By adjusting this angle, you can change the starting position of the first wedge, which can improve the overall presentation of the chart.&lt;/li&gt;
&lt;li&gt;shadow: This boolean attribute adds a shadow effect below the rim of the pie. Setting this to True can make your chart stand out and give it a more three-dimensional appearance, enhancing the overall look of your pie chart in Matplotlib.&lt;/li&gt;
&lt;li&gt;wedgeprops: This parameter accepts a Python dictionary to customize the properties of each wedge in the pie chart. You can specify various attributes such as linewidth, edgecolor, and facecolor. This level of customization allows you to enhance the visual distinction between wedges, making your matplotlib pie chart more informative.&lt;/li&gt;
&lt;li&gt;frame: When set to True, this attribute draws a frame around the pie chart. This can help emphasize the chart's boundaries and improve its visibility, making it clearer when presenting data.
autopct: This attribute controls how the percentages are displayed on the wedges. You can customize the format string to define the appearance of the percentage labels on each slice.
_The explode parameter separates a portion of the chart, and colors define each wedge's color. The autopct function customizes text display, and legend and title functions enhance chart readability and aesthetics. 
_
&lt;/li&gt;
&lt;/ul&gt;

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


# Creating dataset
cars = ['AUDI', 'BMW', 'FORD',
        'TESLA', 'JAGUAR', 'MERCEDES']

data = [23, 17, 35, 29, 12, 41]


# Creating explode data
explode = (0.1, 0.0, 0.2, 0.3, 0.0, 0.0)

# Creating color parameters
colors = ("orange", "cyan", "brown",
          "grey", "indigo", "beige")

# Wedge properties
wp = {'linewidth': 1, 'edgecolor': "green"}

# Creating autocpt arguments


def func(pct, allvalues):
    absolute = int(pct / 100.*np.sum(allvalues))
    return "{:.1f}%\n({:d} g)".format(pct, absolute)


# Creating plot
fig, ax = plt.subplots(figsize=(10, 7))
wedges, texts, autotexts = ax.pie(data,
                                  autopct=lambda pct: func(pct, data),
                                  explode=explode,
                                  labels=cars,
                                  shadow=True,
                                  colors=colors,
                                  startangle=90,
                                  wedgeprops=wp,
                                  textprops=dict(color="magenta"))

# Adding legend
ax.legend(wedges, cars,
          title="Cars",
          loc="center left",
          bbox_to_anchor=(1, 0, 0.5, 1))

plt.setp(autotexts, size=8, weight="bold")
ax.set_title("Customizing pie chart")

# show plot
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nested Pie Chart:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Import libraries
from matplotlib import pyplot as plt
import numpy as np


# Creating dataset
size = 6
cars = ['AUDI', 'BMW', 'FORD',
        'TESLA', 'JAGUAR', 'MERCEDES']

data = np.array([[23, 16], [17, 23],
                 [35, 11], [29, 33],
                 [12, 27], [41, 42]])

# normalizing data to 2 pi
norm = data / np.sum(data)*2 * np.pi

# obtaining ordinates of bar edges
left = np.cumsum(np.append(0,
                           norm.flatten()[:-1])).reshape(data.shape)

# Creating color scale
cmap = plt.get_cmap("tab20c")
outer_colors = cmap(np.arange(6)*4)
inner_colors = cmap(np.array([1, 2, 5, 6, 9,
                              10, 12, 13, 15,
                              17, 18, 20]))

# Creating plot
fig, ax = plt.subplots(figsize=(10, 7),
                       subplot_kw=dict(polar=True))

ax.bar(x=left[:, 0],
       width=norm.sum(axis=1),
       bottom=1-size,
       height=size,
       color=outer_colors,
       edgecolor='w',
       linewidth=1,
       align="edge")

ax.bar(x=left.flatten(),
       width=norm.flatten(),
       bottom=1-2 * size,
       height=size,
       color=inner_colors,
       edgecolor='w',
       linewidth=1,
       align="edge")

ax.set(title="Nested pie chart")
ax.set_axis_off()

# show plot
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Three-dimensional Plotting(3D Plot)&lt;/strong&gt;&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

fig = plt.figure()
ax = plt.axes(projection='3d')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;3d Line plot
&lt;/li&gt;
&lt;/ol&gt;

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

fig = plt.figure()
ax = plt.axes(projection='3d')

z = np.linspace(0, 1, 100)
x = z * np.sin(25 * z)
y = z * np.cos(25 * z)

ax.plot3D(x, y, z, 'green')
ax.set_title('3D Line Plot')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fucmjptxq63tdkoorp4ji.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fucmjptxq63tdkoorp4ji.png" alt=" " width="246" height="252"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;3D Scatter plot
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fig = plt.figure()
ax = plt.axes(projection='3d')

z = np.linspace(0, 1, 100)
x = z * np.sin(25 * z)
y = z * np.cos(25 * z)
c = x + y  # Color array based on x and y

ax.scatter(x, y, z, c=c)
ax.set_title('3D Scatter Plot')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ar3h6wdcmgj862boj78.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ar3h6wdcmgj862boj78.png" alt=" " width="246" height="252"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Surface Plot
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = np.outer(np.linspace(-2, 2, 10), np.ones(10))
y = x.copy().T
z = np.cos(x**2 + y**3)

fig = plt.figure()
ax = plt.axes(projection='3d')
ax.plot_surface(x, y, z, cmap='viridis', edgecolor='green')
ax.set_title('Surface Plot')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsdn3bm5vm7mdg83ob2i3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsdn3bm5vm7mdg83ob2i3.png" alt=" " width="250" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Wireframe Plot
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def f(x, y):
    return np.sin(np.sqrt(x**2 + y**2))

x = np.linspace(-1, 5, 10)
y = np.linspace(-1, 5, 10)
X, Y = np.meshgrid(x, y)
Z = f(X, Y)

fig = plt.figure()
ax = plt.axes(projection='3d')
ax.plot_wireframe(X, Y, Z, color='green')
ax.set_title('Wireframe Plot')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ea0egd2ai5wjwrsguuo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ea0egd2ai5wjwrsguuo.png" alt=" " width="250" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Contour plot in 3d
This plot combines a 3D surface with contour lines to highlight elevation or depth. It helps visualize the function’s shape and gradient changes more clearly in 3D space.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def fun(x, y):
    return np.sin(np.sqrt(x**2 + y**2))

x = np.linspace(-10, 10, 40)
y = np.linspace(-10, 10, 40)
X, Y = np.meshgrid(x, y)
Z = fun(X, Y)

fig = plt.figure(figsize=(10, 8))
ax = plt.axes(projection='3d')
ax.plot_surface(X, Y, Z, cmap='cool', alpha=0.8)

ax.set_title('3D Contour Plot')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')

plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flxci53wclhxgj0952lyn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flxci53wclhxgj0952lyn.png" alt=" " width="390" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Surface Triangulation plot
This plot uses triangular meshes to build a 3D surface from scattered or grid data. It's ideal when the surface is irregular or when using non-rectangular grids.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from matplotlib.tri import Triangulation

def f(x, y):
    return np.sin(np.sqrt(x**2 + y**2))

x = np.linspace(-6, 6, 30)
y = np.linspace(-6, 6, 30)
X, Y = np.meshgrid(x, y)
Z = f(X, Y)

tri = Triangulation(X.ravel(), Y.ravel())

fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(111, projection='3d')
ax.plot_trisurf(tri, Z.ravel(), cmap='cool', edgecolor='none', alpha=0.8)

ax.set_title('Surface Triangulation Plot')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')

plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5ma41onxxfhespqcyzxe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5ma41onxxfhespqcyzxe.png" alt=" " width="390" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Möbius Strip Plot&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A Möbius strip is a one-sided surface with a twist—a famous concept in topology. This plot visualizes its 3D geometry, showing how math and art can blend beautifully.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;R = 2
u = np.linspace(0, 2*np.pi, 100)
v = np.linspace(-1, 1, 100)
u, v = np.meshgrid(u, v)

x = (R + v * np.cos(u / 2)) * np.cos(u)
y = (R + v * np.cos(u / 2)) * np.sin(u)
z = v * np.sin(u / 2)

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

ax.plot_surface(x, y, z, alpha=0.5)

ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_title('Möbius Strip')

ax.set_xlim([-3, 3])
ax.set_ylim([-3, 3])
ax.set_zlim([-3, 3])

plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqw8n96ozobgch7ufmdem.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqw8n96ozobgch7ufmdem.png" alt=" " width="242" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Data Analysis - Python OOPS</title>
      <dc:creator>Rajasekaran Palraj</dc:creator>
      <pubDate>Wed, 19 Nov 2025 01:55:46 +0000</pubDate>
      <link>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-python-oops-4m07</link>
      <guid>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-python-oops-4m07</guid>
      <description>&lt;ol&gt;
&lt;li&gt;Class
A class is a collection of objects. Classes are blueprints for creating objects. A class defines a set of attributes and methods that the created objects (instances) can have.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Some points on Python class:  &lt;/p&gt;

&lt;p&gt;Classes are created by keyword class.&lt;br&gt;
Attributes are the variables that belong to a class.&lt;br&gt;
Attributes are always public and can be accessed using the dot (.) operator. Example: Myclass.Myattribute&lt;br&gt;
Creating a Class&lt;br&gt;
Here, class keyword indicates that we are creating a class followed by name of the class (Dog in this case).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Dog:
    species = "Canine"  # Class attribute

    def __init__(self, name, age):
        self.name = name  # Instance attribute
        self.age = age  # Instance attribute
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation:&lt;/p&gt;

&lt;p&gt;class Dog: Defines a class named Dog.&lt;br&gt;
species: A class attribute shared by all instances of the class.&lt;br&gt;
&lt;strong&gt;init&lt;/strong&gt; method: Initializes the name and age attributes when a new object is created.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Objects
An Object is an instance of a Class. It represents a specific implementation of the class and holds its own data.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;An object consists of:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;State&lt;/strong&gt;: It is represented by the attributes and reflects the properties of an object.&lt;br&gt;
&lt;strong&gt;Behavior&lt;/strong&gt;: It is represented by the methods of an object and reflects the response of an object to other objects.&lt;br&gt;
&lt;strong&gt;Identity&lt;/strong&gt;: It gives a unique name to an object and enables one object to interact with other objects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating Object&lt;/strong&gt;&lt;br&gt;
Creating an object in Python involves instantiating a class to create a new instance of that class. This process is also referred to as object instantiation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Dog:
    species = "Canine"  # Class attribute
​
    def __init__(self, name, age):
        self.name = name  # Instance attribute
        self.age = age  # Instance attribute
​
# Creating an object of the Dog class
dog1 = Dog("Buddy", 3)
​
print(dog1.name) 
print(dog1.species)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output&lt;br&gt;
Buddy&lt;br&gt;
Canine&lt;br&gt;
Explanation:&lt;/p&gt;

&lt;p&gt;dog1 = Dog("Buddy", 3): Creates an object of the Dog class with name as "Buddy" and age as 3.&lt;br&gt;
dog1.name: Accesses the instance attribute name of the dog1 object.&lt;br&gt;
dog1.species: Accesses the class attribute species of the dog1 object.&lt;br&gt;
Self Parameter&lt;br&gt;
Self parameter is a reference to the current instance of the class. It allows us to access the attributes and methods of the object.&lt;/p&gt;

&lt;p&gt;Example: In this example, we create a Dog class with both class and instance attributes, then demonstrate how to access them using the self parameter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Dog:
    species = "Canine"  # Class attribute
​
    def __init__(self, name, age):
        self.name = name  # Instance attribute
        self.age = age  # Instance attribute
​
dog1 = Dog("Buddy", 3)  # Create an instance of Dog
dog2 = Dog("Charlie", 5)  # Create another instance of Dog
​
print(dog1.name, dog1.age, dog1.species)  # Access instance and class attributes
print(dog2.name, dog2.age, dog2.species)  # Access instance and class attributes
print(Dog.species)  # Access class attribute directly
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output&lt;br&gt;
Buddy 3 Canine&lt;br&gt;
Charlie 5 Canine&lt;br&gt;
Canine&lt;br&gt;
Explanation:&lt;/p&gt;

&lt;p&gt;self.name: Refers to the name attribute of the object (dog1) calling the method.&lt;br&gt;
dog1.bark(): Calls the bark method on dog1.&lt;br&gt;
&lt;strong&gt;init&lt;/strong&gt; Method&lt;br&gt;
&lt;strong&gt;init&lt;/strong&gt; method is the constructor in Python, automatically called when a new object is created. It initializes the attributes of the class.&lt;/p&gt;

&lt;p&gt;Example: In this example, we create a Dog class and use &lt;strong&gt;init&lt;/strong&gt; method to set the name and age of each dog when creating an object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Dog:
    def __init__(self, name, age):
        self.name = name
        self.age = age
​
dog1 = Dog("Buddy", 3)
print(dog1.name)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output&lt;br&gt;
Buddy&lt;br&gt;
Explanation:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;init&lt;/strong&gt;: Special method used for initialization.&lt;br&gt;
self.name and self.age: Instance attributes initialized in the constructor.&lt;br&gt;
&lt;strong&gt;Class and Instance Variables&lt;/strong&gt;&lt;br&gt;
In Python, variables defined in a class can be either class variables or instance variables, and understanding the distinction between them is crucial for object-oriented programming.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Class Variables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These are the variables that are shared across all instances of a class. It is defined at the class level, outside any methods. All objects of the class share the same value for a class variable unless explicitly overridden in an object.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Instance Variables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Variables that are unique to each instance (object) of a class. These are defined within the &lt;strong&gt;init&lt;/strong&gt; method or other instance methods. Each object maintains its own copy of instance variables, independent of other objects.&lt;/p&gt;

&lt;p&gt;Example: In this example, we create a Dog class to show difference between class variables and instance variables. We also demonstrate how modifying them affects objects differently.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Dog:
    # Class variable
    species = "Canine"
​
    def __init__(self, name, age):
        # Instance variables
        self.name = name
        self.age = age
​
# Create objects
dog1 = Dog("Buddy", 3)
dog2 = Dog("Charlie", 5)
​
# Access class and instance variables
print(dog1.species)  # (Class variable)
print(dog1.name)     # (Instance variable)
print(dog2.name)     # (Instance variable)
​
# Modify instance variables
dog1.name = "Max"
print(dog1.name)     # (Updated instance variable)
​
# Modify class variable
Dog.species = "Feline"
print(dog1.species)  # (Updated class variable)
print(dog2.species)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output&lt;br&gt;
Canine&lt;br&gt;
Buddy&lt;br&gt;
Charlie&lt;br&gt;
Max&lt;br&gt;
Feline&lt;br&gt;
Feline&lt;br&gt;
Explanation:&lt;/p&gt;

&lt;p&gt;Class Variable (species): Shared by all instances of the class. Changing Dog.species affects all objects, as it's a property of the class itself.&lt;br&gt;
Instance Variables (name, age): Defined in the &lt;strong&gt;init&lt;/strong&gt; method. Unique to each instance (e.g., dog1.name and dog2.name are different).&lt;br&gt;
Accessing Variables: Class variables can be accessed via the class name (Dog.species) or an object (dog1.species). Instance variables are accessed via the object (dog1.name).&lt;br&gt;
Updating Variables: Changing Dog.species affects all instances. Changing dog1.name only affects dog1 and does not impact dog2.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Inheritance
Inheritance allows a class (child class) to acquire properties and methods of another class (parent class). It supports hierarchical classification and promotes code reuse.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Inheritance&lt;/strong&gt;&lt;br&gt;
Types of Inheritance:&lt;br&gt;
Single Inheritance: A child class inherits from a single parent class.&lt;br&gt;
Multiple Inheritance: A child class inherits from more than one parent class.&lt;br&gt;
Multilevel Inheritance: A child class inherits from a parent class, which in turn inherits from another class.&lt;br&gt;
Hierarchical Inheritance: Multiple child classes inherit from a single parent class.&lt;br&gt;
Hybrid Inheritance: A combination of two or more types of inheritance.&lt;br&gt;
Example: In this example, we create a Dog class and demonstrate single, multilevel and multiple inheritance. We show how child classes can use or extend parent class methods.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Single Inheritance
class Dog:
    def __init__(self, name):
        self.name = name
​
    def display_name(self):
        print(f"Dog's Name: {self.name}")
​
class Labrador(Dog):  # Single Inheritance
    def sound(self):
        print("Labrador woofs")
​
# Multilevel Inheritance
class GuideDog(Labrador):  # Multilevel Inheritance
    def guide(self):
        print(f"{self.name}Guides the way!")
​
# Multiple Inheritance
class Friendly:
    def greet(self):
        print("Friendly!")
​
class GoldenRetriever(Dog, Friendly):  # Multiple Inheritance
    def sound(self):
        print("Golden Retriever Barks")
​
# Example Usage
lab = Labrador("Buddy")
lab.display_name()
lab.sound()
​
guide_dog = GuideDog("Max")
guide_dog.display_name()
guide_dog.guide()
​
retriever = GoldenRetriever("Charlie")
retriever.display_name()
retriever.greet()
retriever.sound()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation:&lt;/p&gt;

&lt;p&gt;Single Inheritance: Labrador inherits Dog's attributes and methods.&lt;br&gt;
Multilevel Inheritance: GuideDog extends Labrador, inheriting both Dog and Labrador functionalities.&lt;br&gt;
Multiple Inheritance: GoldenRetriever inherits from both Dog and Friendly.&lt;br&gt;
&lt;strong&gt;4. Polymorphism&lt;/strong&gt;&lt;br&gt;
Polymorphism in Python means "same operation, different behavior." It allows functions or methods with the same name to work differently depending on the type of object they are acting upon.&lt;/p&gt;

&lt;p&gt;Types of Polymorphism&lt;br&gt;
polymorphism_in_python&lt;br&gt;
Polymorphism in Python&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Compile-Time Polymorphism:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This type of polymorphism is determined during the compilation of the program. It allows methods or operators with the same name to behave differently based on their input parameters or usage. In languages like Java or C++, compile-time polymorphism is achieved through method overloading but it's not directly supported in Python.&lt;/p&gt;

&lt;p&gt;In Python:&lt;/p&gt;

&lt;p&gt;True compile-time polymorphism is not supported.&lt;br&gt;
Instead, Python mimics it using default arguments or &lt;em&gt;args/&lt;/em&gt;*kwargs.&lt;br&gt;
Operator overloading can also be seen as part of polymorphism, though it is implemented at runtime in Python.&lt;br&gt;
Example:&lt;/p&gt;

&lt;p&gt;class Calculator:&lt;br&gt;
    def add(self, *args):&lt;br&gt;
        return sum(args)&lt;br&gt;
​&lt;br&gt;
calc = Calculator()&lt;br&gt;
print(calc.add(5, 10))       # Two arguments&lt;br&gt;
print(calc.add(5, 10, 15))   # Three arguments&lt;br&gt;
print(calc.add(1, 2, 3, 4))  # Any number of arguments&lt;/p&gt;

&lt;p&gt;Output&lt;br&gt;
15&lt;br&gt;
30&lt;br&gt;
10&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run-Time Polymorphism&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Run-Time Polymorphism is determined during the execution of the program. It covers multiple forms in Python:&lt;/p&gt;

&lt;p&gt;Method Overriding: A subclass redefines a method from its parent class.&lt;br&gt;
Duck Typing: If an object implements the required method, it works regardless of its type.&lt;br&gt;
Operator Overloading: Special methods (&lt;strong&gt;add&lt;/strong&gt;, &lt;strong&gt;sub&lt;/strong&gt;, etc.) redefine how operators behave for user-defined objects.&lt;br&gt;
Example: In this example, we show run-time polymorphism using method overriding with dog classes and compile-time polymorphism by mimicking method overloading in a calculator class.&lt;/p&gt;
&lt;h1&gt;
  
  
  Method Overriding
&lt;/h1&gt;
&lt;h1&gt;
  
  
  We start with a base class and then a subclass that "overrides" the speak method.
&lt;/h1&gt;

&lt;p&gt;class Animal:&lt;br&gt;
    def speak(self):&lt;br&gt;
        return "I am an animal."&lt;br&gt;
​&lt;br&gt;
class Dog(Animal):&lt;br&gt;
    def speak(self):&lt;br&gt;
        return "Woof!"&lt;br&gt;
​&lt;br&gt;
print(Dog().speak())&lt;br&gt;
​&lt;/p&gt;
&lt;h1&gt;
  
  
  2 Duck Typing
&lt;/h1&gt;

&lt;p&gt;class Cat:&lt;br&gt;
    def speak(self):&lt;br&gt;
        return "Meow!"&lt;br&gt;
​&lt;br&gt;
def make_animal_speak(animal):&lt;br&gt;
    # This function works for both Dog and Cat because they both have a 'speak' method.&lt;br&gt;
    return animal.speak()&lt;br&gt;
​&lt;br&gt;
print(make_animal_speak(Cat()))&lt;br&gt;
print(make_animal_speak(Dog()))&lt;br&gt;
​&lt;/p&gt;
&lt;h1&gt;
  
  
  3 Operator Overloading
&lt;/h1&gt;
&lt;h1&gt;
  
  
  We create a simple class that customizes the '+' operator.
&lt;/h1&gt;

&lt;p&gt;class Vector:&lt;br&gt;
    def &lt;strong&gt;init&lt;/strong&gt;(self, x, y):&lt;br&gt;
        self.x = x&lt;br&gt;
        self.y = y&lt;br&gt;
​&lt;br&gt;
    def &lt;strong&gt;add&lt;/strong&gt;(self, other):&lt;br&gt;
        # This special method defines the behavior of the '+' operator.&lt;br&gt;
        return Vector(self.x + other.x, self.y + other.y)&lt;br&gt;
​&lt;br&gt;
    def &lt;strong&gt;repr&lt;/strong&gt;(self):&lt;br&gt;
        return f"Vector({self.x}, {self.y})"&lt;br&gt;
​&lt;br&gt;
v1 = Vector(2, 3)&lt;br&gt;
v2 = Vector(4, 5)&lt;br&gt;
v3 = v1 + v2&lt;br&gt;
​&lt;br&gt;
print(v3)&lt;br&gt;
Explanation:&lt;/p&gt;

&lt;p&gt;Method Overriding: Dog class overrides the speak method from the parent Animal class. This allows the program to call the speak method on a Dog object and get a specialized "Woof!" response, which is determined at runtime.&lt;br&gt;
Duck Typing: "make_animal_speak" function can accept both a Dog and a Cat object. It doesn't care about their class hierarchy; it only checks if they have a speak method, showcasing Python's flexible typing.&lt;br&gt;
Operator Overloading: "&lt;strong&gt;add&lt;/strong&gt;" method within the Vector class is a special method that defines how the + operator behaves for Vector objects. This allows the user to add two vectors using the familiar + symbol, which is a form of syntactic sugar.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Encapsulation
Encapsulation is the bundling of data (attributes) and methods (functions) within a class, restricting access to some components to control interactions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A class is an example of encapsulation as it encapsulates all the data that is member functions, variables, etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Encapsulation&lt;/strong&gt;&lt;br&gt;
Types of Encapsulation:&lt;br&gt;
Public Members: Accessible from anywhere.&lt;br&gt;
Protected Members: Accessible within the class and its subclasses.&lt;br&gt;
Private Members: Accessible only within the class.&lt;br&gt;
Example: In this example, we create a Dog class with public, protected and private attributes. We also show how to access and modify private members using getter and setter methods.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Dog:
    def __init__(self, name, breed, age):
        self.name = name  # Public attribute
        self._breed = breed  # Protected attribute
        self.__age = age  # Private attribute
​
    # Public method
    def get_info(self):
        return f"Name: {self.name}, Breed: {self._breed}, Age: {self.__age}"
​
    # Getter and Setter for private attribute
    def get_age(self):
        return self.__age
​
    def set_age(self, age):
        if age &amp;gt; 0:
            self.__age = age
        else:
            print("Invalid age!")
​
# Example Usage
dog = Dog("Buddy", "Labrador", 3)
​
# Accessing public member
print(dog.name)  # Accessible
​
# Accessing protected member
print(dog._breed)  # Accessible but discouraged outside the class
​
# Accessing private member using getter
print(dog.get_age())
​
# Modifying private member using setter
dog.set_age(5)
print(dog.get_info())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation:&lt;/p&gt;

&lt;p&gt;Public Members: Easily accessible, such as name.&lt;br&gt;
Protected Members: Used with a single &lt;em&gt;, such as _breed. Access is discouraged but allowed in subclasses.&lt;br&gt;
Private Members: Used with _&lt;/em&gt;, such as __age. Access requires getter and setter methods.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Data Abstraction 
Abstraction hides the internal implementation details while exposing only the necessary functionality. It helps focus on "what to do" rather than "how to do it."&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Types of Abstraction:&lt;br&gt;
Partial Abstraction: Abstract class contains both abstract and concrete methods.&lt;br&gt;
Full Abstraction: Abstract class contains only abstract methods (like interfaces).&lt;br&gt;
Example: In this example, we create an abstract Dog class with an abstract method (sound) and a concrete method. Subclasses implement the abstract method while inheriting the concrete method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from abc import ABC, abstractmethod
​
class Dog(ABC):  # Abstract Class
    def __init__(self, name):
        self.name = name
​
    @abstractmethod
    def sound(self):  # Abstract Method
        pass
​
    def display_name(self):  # Concrete Method
        print(f"Dog's Name: {self.name}")
​
class Labrador(Dog):  # Partial Abstraction
    def sound(self):
        print("Labrador Woof!")
​
class Beagle(Dog):  # Partial Abstraction
    def sound(self):
        print("Beagle Bark!")
​
# Example Usage
dogs = [Labrador("Buddy"), Beagle("Charlie")]
for dog in dogs:
    dog.display_name()  # Calls concrete method
    dog.sound()  # Calls implemented abstract method

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation:&lt;/p&gt;

&lt;p&gt;Partial Abstraction: The Dog class has both abstract (sound) and concrete (display_name) methods.&lt;br&gt;
Why Use It: Abstraction ensures consistency in derived classes by enforcing the implementation of abstract methods.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Data Analysis Week 5 Notes</title>
      <dc:creator>Rajasekaran Palraj</dc:creator>
      <pubDate>Wed, 19 Nov 2025 01:55:29 +0000</pubDate>
      <link>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-week-5-notes-lio</link>
      <guid>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-week-5-notes-lio</guid>
      <description>&lt;p&gt;&lt;strong&gt;Business Intelligence Overview&lt;/strong&gt;&lt;br&gt;
Business intelligence refers to a collection of mathematical models and analysis methods that utilize data to produce valuable information and insight for making important decisions.&lt;/p&gt;

&lt;p&gt;Main Components of Business Intelligence System:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data Source &lt;/li&gt;
&lt;li&gt;Data Mart / Data Warehouse &lt;/li&gt;
&lt;li&gt;Data Exploration&lt;/li&gt;
&lt;li&gt;Data Mining&lt;/li&gt;
&lt;li&gt;Optimization&lt;/li&gt;
&lt;li&gt;Decisions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Data Source&lt;/strong&gt;&lt;br&gt;
The first step is gathering and consolidating data from an array of primary and secondary sources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Mart / Data Warehouse&lt;/strong&gt;&lt;br&gt;
Through the utilization of extraction and transformation tools, also known as extract, transform, load (ETL), data is acquired from various sources and saved in databases designed specifically for business intelligence analysis. These databases, commonly known as data warehouses and data marts, serve as a centralized location for the gathered data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Exploration&lt;/strong&gt;&lt;br&gt;
The third level of the pyramid offers essential resources for conducting a passive analysis in business intelligence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Mining&lt;/strong&gt;&lt;br&gt;
The fourth level, known as active business intelligence methodologies, focuses on extracting valuable information and knowledge from data. We will delve into various techniques such as mathematical models, pattern recognition, machine learning, and data mining.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Optimization&lt;/strong&gt;&lt;br&gt;
As you ascend the pyramid, you'll encounter optimization models that empower you to choose the most optimal course of action among various alternatives, which can often be quite extensive or even endless. These models have also been effectively incorporated in marketing and logistics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Users of Business Intelligence&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Analyst (Data Analyst or Business Analyst):&lt;/strong&gt; They are the statistician of the company, they used BI on the basis of historical data priorly stored in the system.&lt;br&gt;
&lt;strong&gt;Head or Manager of the Company:&lt;/strong&gt; Head of the company uses Business Intelligence used to increase the profitability of their company by increasing the efficiency in their decisions on the basis of all the knowledge they discovered.&lt;br&gt;
Small Business Owners: Can be used by a small businessman because it is quite affordable too.&lt;br&gt;
**Government Officials: **In the decision-making of the government.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Decisions Supported by Business Intelligence&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Strategic Level:&lt;/strong&gt; The strategic level is the level where the Heads of the company decide the strategies of any business.&lt;br&gt;
&lt;strong&gt;Tactical Level:&lt;/strong&gt; Once the strategy is made though for handling all the details and matters have a tactical level where all the technologies and methodologies come under one umbrella. This level is further responsible for continuously updating the data.&lt;br&gt;
**Operational Level: **Operation decisions are made at this level. Operational decisions help in operating the system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Power BI
&lt;/h2&gt;

&lt;p&gt;Power BI is a Microsoft-powered business intelligence tool that helps transform raw data into interactive dashboards and actionable insights. It allow users to connect to various data sources, clean and shape data and visualize it using charts, graphs and reports all with minimal coding.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Power BI Used For?&lt;/strong&gt;&lt;br&gt;
Power BI is a tool that helps you understand your data better. you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bring in data from different places like Excel files, SQL databases, CSVs, JSON files and even websites.&lt;/li&gt;
&lt;li&gt;Clean and fix your data easily without writing code.&lt;/li&gt;
&lt;li&gt;Create visuals like bar charts, line graphs, pie charts and dashboards to help you see patterns and trends.&lt;/li&gt;
&lt;li&gt;Analyze your data using filters and slicers, so you can focus on specific details like sales by region or product performance over time.&lt;/li&gt;
&lt;li&gt;Share your dashboards with your team or clients so everyone stays informed and can explore the data on their own.&lt;/li&gt;
&lt;li&gt;Set up automatic updates so your reports always show the latest information without you having to do anything.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key Components of Power BI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Power BI Desktop:&lt;/strong&gt; This is the free version you can install on your computer. It lets you connect to data, clean it and create reports.&lt;br&gt;
&lt;strong&gt;Power BI Service:&lt;/strong&gt; This is the online version. You can upload your reports here share them with others and view them from anywhere using the internet.&lt;br&gt;
&lt;strong&gt;Power BI Mobile:&lt;/strong&gt; There are mobile apps for iOS and Android and you can use them to see and interact with your reports on your phone or tablet.&lt;br&gt;
&lt;strong&gt;Power BI Gateway:&lt;/strong&gt; This helps you to connect data from your own company’s servers to Power BI and you can use that data in your reports and dashboards.&lt;br&gt;
&lt;strong&gt;Power BI Report Server:&lt;/strong&gt; This provide companies to keep and share Power BI reports on their own private server instead of using the cloud.&lt;br&gt;
&lt;strong&gt;Power BI Embedded:&lt;/strong&gt; It allow businesses to add Power BI reports into their own apps or websites. People can view the reports without opening Power BI separately.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fos307jrztdw410yd2myv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fos307jrztdw410yd2myv.png" alt=" " width="800" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tips for Using Power BI Effectively&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Learn DAX for Advanced Calculations:&lt;/strong&gt; DAX is a formula language that can help you perform advanced calculations. If you want to create more complex analytics learning DAX is a good idea.&lt;br&gt;
&lt;strong&gt;Master Power Query:&lt;/strong&gt; Power Query helps you to prepare your data. The more you learn about it the more efficient your workflow will be.&lt;br&gt;
&lt;strong&gt;Stay Organized:&lt;/strong&gt; When you create more reports it's important to keep things organized by giving fields, calculations clear and descriptive names.&lt;br&gt;
&lt;strong&gt;Explore Templates:&lt;/strong&gt; It has many templates for different industries. Use them to get started quickly and spark new ideas for your own reports.&lt;/p&gt;

&lt;p&gt;7 Benefits of Microsoft Power BI:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Easy to Connect Data&lt;/li&gt;
&lt;li&gt;Provides Data Governance and Security&lt;/li&gt;
&lt;li&gt;Artificial Intelligence Integration&lt;/li&gt;
&lt;li&gt;Allows Users to Build Personalized Dashboards and Interactive Reports Easily&lt;/li&gt;
&lt;li&gt;Offers Familiar Excel Integration&lt;/li&gt;
&lt;li&gt;Affordable and Cost-Effective&lt;/li&gt;
&lt;li&gt;Provides Monthly Updates&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Power Query Editor in Power BI
&lt;/h2&gt;

&lt;p&gt;Power Query Editor is a tool in Power BI Desktop used for data transformation and preparation. It allow to connect, shape and transform multiple data sources according to the user's needs. After making the desired changes the transformed data is then loaded to the Power BI desktop to fetch final outputs and reports. It can be in two modes as desktop or online.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Data Analysis SQL Advanced</title>
      <dc:creator>Rajasekaran Palraj</dc:creator>
      <pubDate>Wed, 19 Nov 2025 01:55:02 +0000</pubDate>
      <link>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-sql-advanced-82o</link>
      <guid>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-sql-advanced-82o</guid>
      <description>&lt;h2&gt;
  
  
  Stored Procedures
&lt;/h2&gt;

&lt;p&gt;A SQL Stored Procedure is a collection of SQL statements bundled together to perform a specific task. These procedures are stored in the database and can be called upon by users, applications, or other procedures. Stored procedures are essential for automating database tasks, improving efficiency, and reducing redundancy. By encapsulating logic within stored procedures, developers can streamline their workflow and enforce consistent business rules across multiple applications and systems.&lt;/p&gt;

&lt;p&gt;CREATE PROCEDURE procedure_name&lt;br&gt;
(parameter1 data_type, parameter2 data_type, ...)&lt;br&gt;
AS&lt;br&gt;
BEGIN&lt;br&gt;
   -- SQL statements to be executed&lt;br&gt;
END&lt;/p&gt;
&lt;h2&gt;
  
  
  Types of SQL Stored Procedures
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;System Stored Procedures(ss_help, ss_rename)&lt;/li&gt;
&lt;li&gt;User-Defined Stored Procedures (UDPs)&lt;/li&gt;
&lt;li&gt;Extended Stored Procedures&lt;/li&gt;
&lt;li&gt;CLR Stored Procedures&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;SQL Triggers&lt;/p&gt;

&lt;p&gt;A trigger is a special stored procedure in a database that automatically executes when specific events (like INSERT, UPDATE, or DELETE) occur on a table. Triggers help automate tasks, maintain data consistency, and record database activities. Each trigger is tied to a particular table and runs without manual execution.&lt;/p&gt;

&lt;p&gt;Uses of SQL Triggers&lt;/p&gt;

&lt;p&gt;Automation: Handles repetitive tasks.&lt;br&gt;
Data Integrity: Ensures clean and accurate data.&lt;br&gt;
Business Rules: Enforces database logic.&lt;br&gt;
Audit Trails: Tracks and records changes.&lt;/p&gt;
&lt;h2&gt;
  
  
  Types of SQL Triggers
&lt;/h2&gt;

&lt;p&gt;*&lt;em&gt;1. DDL Triggers *&lt;/em&gt;&lt;br&gt;
&lt;code&gt;CREATE TRIGGER prevent_table_creation&lt;br&gt;
ON DATABASE&lt;br&gt;
FOR CREATE_TABLE, ALTER_TABLE, DROP_TABLE&lt;br&gt;
AS &lt;br&gt;
BEGIN&lt;br&gt;
   PRINT 'you can not create, drop and alter table in this database';&lt;br&gt;
   ROLLBACK;&lt;br&gt;
END;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. DML Triggers&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;CREATE TRIGGER prevent_update &lt;br&gt;
ON students&lt;br&gt;
FOR UPDATE &lt;br&gt;
AS &lt;br&gt;
BEGIN &lt;br&gt;
   PRINT 'You can not insert, update and delete this table i'; &lt;br&gt;
   ROLLBACK; &lt;br&gt;
END;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Logon Triggers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;CREATE TRIGGER track_logon&lt;br&gt;
ON LOGON&lt;br&gt;
AS&lt;br&gt;
BEGIN&lt;br&gt;
   PRINT 'A new user has logged in.';&lt;br&gt;
END;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;GRAND and REVOKE&lt;/p&gt;

&lt;p&gt;CREATE USER 'report_user'@'localhost' IDENTIFIED BY 'StrongPass123';&lt;/p&gt;

&lt;p&gt;GRANT ALL PRIVILEGES ON companydb.* TO 'report_user'@'localhost';&lt;/p&gt;

&lt;p&gt;GRANT SELECT ON companydb.Employees TO 'report_user'@'localhost';&lt;/p&gt;

&lt;p&gt;GRANT INSERT, UPDATE ON companydb.Employees TO 'report_user'@'localhost';&lt;/p&gt;

&lt;p&gt;REVOKE INSERT ON companydb.Employees FROM 'report_user'@'localhost';&lt;/p&gt;

&lt;p&gt;REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'report_user'@'localhost';&lt;/p&gt;

&lt;p&gt;FLUSH PRIVILEGES;&lt;/p&gt;

&lt;p&gt;SHOW GRANTS FOR 'report_user'@'localhost';&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 e 


-- Create a stored procedure named "GetEmployeesBySalary"
DELIMITER //
CREATE PROCEDURE GetEmployeesBySalaryNew(IN p_salary INT)
BEGIN
    SELECT id, first_name, last_name 
    FROM Employees
    WHERE salary = p_salary;
END //
DELIMITER ;

-- Execute the stored procedure with parameter "Sri lanka"
CALL GetEmployeesBySalaryNew(60000);

DELIMITER //
create function calcuate_bonus(salary INT)
RETURNS DECIMAL(10, 2)
DETERMINISTIC
BEGIN
    RETURN salary*0.5;
END

select emp_id,first_name,salary,calcuate_bonus(salary) from Employees e 


DROP PROCEDURE IF EXISTS GetEmployeesBySalary;



DELIMITER $$

CREATE TRIGGER after_employee_insert
AFTER INSERT ON Employees
FOR EACH ROW
BEGIN
    INSERT INTO employee_log (emp_id, action, created_at)
    VALUES (NEW.emp_id, 'Inserted', NOW());
END

$$

DELIMITER ;

create table employee_log(
emp_id int,
action varchar(50),
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
)


INSERT INTO employees.Employees
(emp_id, first_name, last_name, dept_id, salary, hire_date, manager_id)
VALUES(112, 'Ashok', 'Rohit', 4, 90000.00, '2021-09-12', 103);

select * from employee_log el 




select * from Employees e 

Explain select * from Employees e where emp_id=101;

Explain select * from Employees e where first_name='Raj';


SET @running_total := 0;
select cumulative_sum from (
SELECT
    salary,
    (@running_total := @running_total + salary) AS cumulative_sum
FROM
    Employees e 
ORDER BY
    salary) t order by cumulative_sum desc limit 1 ;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Data Analysis - Power BI Notes</title>
      <dc:creator>Rajasekaran Palraj</dc:creator>
      <pubDate>Wed, 19 Nov 2025 01:52:21 +0000</pubDate>
      <link>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-power-bi-notes-17mk</link>
      <guid>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-power-bi-notes-17mk</guid>
      <description>&lt;p&gt;Power BI DAX (Data Analysis Expressions) functions are grouped into categories. I’ll explain the main types, then give sample data and queries for each so you can see how they’re used in practice.&lt;/p&gt;

&lt;p&gt;What is DAX Used for?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create New Columns on a table&lt;/li&gt;
&lt;li&gt;Method of connecting Disparate Data Sources with multiple Key Columns&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Calculated Columns&lt;/strong&gt;&lt;br&gt;
Create New Columns on a table&lt;br&gt;
Method for Connecting Disparate Data Sources with Multiple Key&lt;br&gt;
Columns&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Calculated Measures&lt;/strong&gt;&lt;br&gt;
Create Dynamic Calculations for Reporting&lt;br&gt;
Ratios/Percentages&lt;br&gt;
Time Intelligence Calulations&lt;br&gt;
Complex Relationships&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Calculated Tables&lt;/strong&gt;&lt;br&gt;
Create a new table derived from another table&lt;br&gt;
Can be used to create a date table when one doesn’t exist already&lt;/p&gt;

&lt;p&gt;Navigation Funcations:&lt;/p&gt;

&lt;p&gt;RElated&lt;/p&gt;

&lt;p&gt;RElated TAble&lt;/p&gt;

&lt;p&gt;🔹 Categories of DAX Functions&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Aggregate Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;SUM, AVERAGE, MIN, MAX, COUNT, DISTINCTCOUNT&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Logical Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;IF, AND, OR, SWITCH&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Text Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CONCATENATE, LEFT, RIGHT, LEN, SEARCH, REPLACE&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Date &amp;amp; Time Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;TODAY, NOW, YEAR, MONTH, DAY, EOMONTH, DATEDIFF&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Filter Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CALCULATE, FILTER, ALL, ALLEXCEPT, RELATEDTABLE&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time Intelligence Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;TOTALYTD, SAMEPERIODLASTYEAR, DATESYTD, PREVIOUSMONTH, PARALLELPERIOD&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mathematical &amp;amp; Trigonometric Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;ROUND, ROUNDUP, ROUNDDOWN, ABS, DIVIDE, POWER&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Information Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;ISBLANK, ISNUMBER, ISTEXT, ISFILTERED&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Relationship Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;RELATED, RELATEDTABLE, USERELATIONSHIP&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Iterator (X) Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;SUMX, AVERAGEX, MAXX, MINX, COUNTX&lt;/p&gt;

&lt;p&gt;Stacked Bar Chart:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;select Y axis and X axis and legend&lt;/li&gt;
&lt;li&gt;Rename &lt;/li&gt;
&lt;li&gt;Small multiples in Power BI is a visualization feature that breaks down a single chart into a grid of smaller, individual charts, each displaying data for a specific category of a chosen dimension&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Types Of Bar Charts&lt;/strong&gt;&lt;br&gt;
 There are mainly two variations of Bar Chats. Depending on the situation charts are used.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Clustered Bar Charts:&lt;/strong&gt; This is a default Bar chart where all the categories are displayed against the same value category.&lt;br&gt;
&lt;strong&gt;Stacked Bar Charts:&lt;/strong&gt; These are the basic typed charts that allow the comparison of one category to another category.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Main Parts of Stacked Bar Charts&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Title&lt;/strong&gt;: It denotes the information about the chart&lt;br&gt;
&lt;strong&gt;X-axis&lt;/strong&gt;: It is the individual entry for the category to be presented&lt;br&gt;
&lt;strong&gt;Legend&lt;/strong&gt;:  It is the different category that will contribute to the charts&lt;br&gt;
&lt;strong&gt;Y-axis&lt;/strong&gt;: It is for the value against each type of category&lt;br&gt;
&lt;strong&gt;Bars&lt;/strong&gt;: These heights represent the total value of all the legend&lt;/p&gt;

&lt;h2&gt;
  
  
  The format pane in Power BI custom visuals
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.microsoft.com/en-us/security/business/microsoft-intune" rel="noopener noreferrer"&gt;https://www.microsoft.com/en-us/security/business/microsoft-intune&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Types of graphs:&lt;br&gt;
Bar chart(Stacked, Clustered, 100% stacked)&lt;br&gt;
Column chart(Stacked, Clustered, 100% stacked)&lt;/p&gt;

&lt;p&gt;visual calculations&lt;/p&gt;

&lt;p&gt;A visual calculation is a DAX calculation defined and executed directly on a visual. Visual calculations make it easier to create calculations that were previously hard to create, leading to simpler DAX, easier maintenance, and better performance.&lt;/p&gt;

&lt;p&gt;Semantic Model:&lt;/p&gt;

&lt;p&gt;Paginated Reports:&lt;/p&gt;

&lt;p&gt;1: Dimension Modeling&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Multiple Fact Table&lt;/li&gt;
&lt;li&gt;Role Playing Table&lt;/li&gt;
&lt;li&gt;Data Analyst of the future&lt;/li&gt;
&lt;li&gt;Data Modeling&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Dimension Model - organize data&lt;br&gt;
fact table - fact is an event that may or may not include measures&lt;br&gt;
Dimension table - category of information or noun , descriptive&lt;br&gt;
Attribute - (Column in dimension table ) descriptor of the object&lt;/p&gt;

&lt;p&gt;Fact tables&lt;/p&gt;

&lt;p&gt;Conceptual Model&lt;br&gt;
Logical Model&lt;/p&gt;

&lt;p&gt;surogate key&lt;/p&gt;

&lt;p&gt;calculate&lt;/p&gt;

&lt;p&gt;useRElationship&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Data Analysis Pandas Notes</title>
      <dc:creator>Rajasekaran Palraj</dc:creator>
      <pubDate>Sat, 11 Oct 2025 04:49:44 +0000</pubDate>
      <link>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-pandasnumpy-notes-41d6</link>
      <guid>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-pandasnumpy-notes-41d6</guid>
      <description>&lt;p&gt;Pandas (stands for Python Data Analysis) is an open-source software library designed for data manipulation and analysis.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Revolves around two primary Data structures: Series (1D) and DataFrame (2D)&lt;/li&gt;
&lt;li&gt;Built on top of NumPy, efficiently manages large datasets, offering tools for data cleaning, transformation, and analysis.&lt;/li&gt;
&lt;li&gt;Tools for working with time series data, including date range generation and frequency conversion. For example, we can convert date or time columns into pandas’ datetime type using pd.to_datetime(), or specify parse_dates=True during CSV loading.&lt;/li&gt;
&lt;li&gt;Seamlessly integrates with other Python libraries like NumPy, Matplotlib, and scikit-learn.&lt;/li&gt;
&lt;li&gt;Provides methods like .dropna() and .fillna() to handle missing values seamlessly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is a various tasks that we can do using Pandas:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Cleaning, Merging and Joining&lt;/strong&gt;: Clean and combine data from multiple sources, handling inconsistencies and duplicates.&lt;br&gt;
&lt;strong&gt;Handling Missing Data:&lt;/strong&gt; Manage missing values (NaN) in both floating and non-floating point data.&lt;br&gt;
&lt;strong&gt;Column Insertion and Deletion&lt;/strong&gt;: Easily add, remove or modify columns in a DataFrame.&lt;br&gt;
&lt;strong&gt;Group By Operations&lt;/strong&gt;: Use "split-apply-combine" to group and analyze data.&lt;br&gt;
&lt;strong&gt;Data Visualization&lt;/strong&gt;: Create visualizations with Matplotlib and Seaborn, integrated with Pandas.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pandas Dataframe:&lt;/strong&gt;&lt;br&gt;
A Pandas DataFrame is a two-dimensional table-like structure in Python where data is arranged in rows and columns. It’s one of the most commonly used tools for handling data and makes it easy to organize, analyze and manipulate data. It can store different types of data such as numbers, text and dates across its columns. The main parts of a DataFrame are:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data&lt;/strong&gt;: Actual values in the table.&lt;br&gt;
&lt;strong&gt;Rows&lt;/strong&gt;: Labels that identify each row.&lt;br&gt;
&lt;strong&gt;Columns&lt;/strong&gt;: Labels that define each data category.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating Empty DataFrame:&lt;/strong&gt;&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

df = pd.DataFrame()

print(df)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Creating a DataFrame from a List&lt;br&gt;
A simple way to create a DataFrame is by using a single list. Pandas automatically assigns index values to the rows when you pass a list.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each item in the list becomes a row.&lt;/li&gt;
&lt;li&gt;The DataFrame consists of a single unnamed column.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pandas as pd
​
lst = ['Geeks', 'For', 'Geeks', 'is', 
            'portal', 'for', 'Geeks']
​
df = pd.DataFrame(lst)
print(df)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Creating a DataFrame from a List of Dictionaries&lt;br&gt;&lt;br&gt;
It represents data where each dictionary corresponds to a row. This method is useful for handling structured data from APIs or JSON files. It is commonly used in web scraping and API data processing since JSON responses often contain lists of dictionaries.&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
​
dict = {'name':["aparna", "pankaj", "sudhir", "Geeku"],
        'degree': ["MBA", "BCA", "M.Tech", "MBA"],
        'score':[90, 40, 80, 98]}
​
df = pd.DataFrame(dict)
​
print(df)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add index Explicitly:&lt;br&gt;
&lt;code&gt;df = pd.DataFrame(dict,index=['Rollno1','Rollno2','Rollno3','Rollno4'])&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Method #2: Using from_dict() function&lt;/p&gt;

&lt;p&gt;&lt;code&gt;df = pd.DataFrame.from_dict(dict)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Create dataframe by passing lists variable to dictionary&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

# dictionary of lists
name=['aparna', 'pankaj', 'sudhir', 'Geeku']
degree=['MBA','BCA', 'M.Tech', 'MBA']
score=[90, 40, 80, 98]
dict = {'name':name,
        'degree':degree ,
        'score':score}

df = pd.DataFrame(dict,index=['Rollno1','Rollno2','Rollno3','Rollno4'])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pandas Dataframe Index:&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

data = {'Name': ['John', 'Alice', 'Bob', 'Eve', 'Charlie'],
        'Age': [25, 30, 22, 35, 28],
        'Gender': ['Male', 'Female', 'Male', 'Female', 'Male'],
        'Salary': [50000, 55000, 40000, 70000, 48000]}

df = pd.DataFrame(data)
print(df.index)  # Accessing the index
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Custom Index:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Set 'Name' column as the index
df_with_index = df.set_index('Name')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Resetting the Index&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Reset the index back to the default integer index
df_reset = df.reset_index()
print(df_reset)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Indexing with loc&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;row = df.loc['Alice']
print(row)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Changing the Index&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Set 'Age' as the new index
df_with_new_index = df.set_index('Age')
print(df_with_new_index)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Accessing Columns From DataFrame&lt;/strong&gt;&lt;br&gt;
Columns in a DataFrame can be accessed individually using bracket notation Accessing a column retrieves that column as a Series, which can then be further manipulated.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Access the 'Age' column
age_column = df['Age']
print(age_column)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Accessing Rows by Index&lt;/p&gt;

&lt;p&gt;To access specific rows in a DataFrame, you can use iloc (for positional indexing) or loc (for label-based indexing). These methods allow you to retrieve rows based on their index positions or labels.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Access the row at index 1 (second row)
second_row = df.iloc[1]
print(second_row)



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Accessing Multiple Rows or Columns&lt;br&gt;
You can access multiple rows or columns at once by passing a list of column names or index positions. This is useful when you need to select several columns or rows for further analysis.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Access the first three rows and the 'Name' and 'Age' columns
subset = df.loc[0:2, ['Name', 'Age']]
df.loc[2,'Gender']
print(subset)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;. Accessing Rows Based on Conditions&lt;br&gt;
Pandas allows you to filter rows based on conditions, which can be very powerful for exploring subsets of data that meet specific criteria.&lt;/p&gt;
&lt;h1&gt;
  
  
  Access rows where 'Age' is greater than 25
&lt;/h1&gt;

&lt;p&gt;filtered_data = df[df['Age'] &amp;gt; 25]&lt;br&gt;
print(filtered_data)&lt;/p&gt;

&lt;p&gt;Accessing Specific Cells with at and iat&lt;br&gt;
If you need to access a specific cell, you can use the .at[] method for label-based indexing and the .iat[] method for integer position-based indexing. These are optimized for fast access to single values.&lt;/p&gt;
&lt;h1&gt;
  
  
  Access the 'Salary' of the row with label 2
&lt;/h1&gt;

&lt;p&gt;salary_at_index_2 = df.at[2, 'Salary']&lt;br&gt;
print(salary_at_index_2)&lt;/p&gt;

&lt;p&gt;output = data.iat[row, column]&lt;/p&gt;

&lt;p&gt;Indexing and Selecting Data with Pandas&lt;/p&gt;

&lt;p&gt;first = data["Age"]&lt;/p&gt;

&lt;p&gt;first.head(5)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Selecting Multiple Columns
first = data[["Age", "College", "Salary"]]&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Indexing with .loc[ ]&lt;br&gt;
The.loc[] function is used for label-based indexing. It allows us to access rows and columns by their labels. Unlike the indexing operator, it can select subsets of rows and columns simultaneously which offers flexibility in data retrieval.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Selecting a Single Row by Label
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pandas as pd
data = pd.read_csv("/content/nba.csv", index_col="Name")

row = data.loc["Avery Bradley"]
print(row)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fovr5wayk0rml14et9t90.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fovr5wayk0rml14et9t90.png" alt=" " width="740" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Concatenating DataFrame using .concat()
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pandas as pd

data1 = {'Name': ['Jai', 'Princi', 'Gaurav', 'Anuj'],
         'Age': [27, 24, 22, 32],
         'Address': ['Nagpur', 'Kanpur', 'Allahabad', 'Kannuaj'],
         'Qualification': ['Msc', 'MA', 'MCA', 'Phd']}

data2 = {'Name': ['Abhi', 'Ayushi', 'Dhiraj', 'Hitesh'],
         'Age': [17, 14, 12, 52],
         'Address': ['Nagpur', 'Kanpur', 'Allahabad', 'Kannuaj'],
         'Qualification': ['Btech', 'B.A', 'Bcom', 'B.hons']}

df = pd.DataFrame(data1, index=[0, 1, 2, 3])

df1 = pd.DataFrame(data2, index=[4, 5, 6, 7])

print(df, "\n\n", df1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Concatenating DataFrames by Setting Logic on Axes
We can modify the concatenation by setting logic on the axes. Specifically we can choose whether to take the Union (join='outer') or Intersection (join='inner') of columns.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pandas as pd

data1 = {'Name': ['Jai', 'Princi', 'Gaurav', 'Anuj'],
         'Age': [27, 24, 22, 32],
         'Address': ['Nagpur', 'Kanpur', 'Allahabad', 'Kannuaj'],
         'Qualification': ['Msc', 'MA', 'MCA', 'Phd'],
         'Mobile No': [97, 91, 58, 76]}

data2 = {'Name': ['Gaurav', 'Anuj', 'Dhiraj', 'Hitesh'],
         'Age': [22, 32, 12, 52],
         'Address': ['Allahabad', 'Kannuaj', 'Allahabad', 'Kannuaj'],
         'Qualification': ['MCA', 'Phd', 'Bcom', 'B.hons'],
         'Salary': [1000, 2000, 3000, 4000]}

df = pd.DataFrame(data1, index=[0, 1, 2, 3])

df1 = pd.DataFrame(data2, index=[2, 3, 6, 7])

print(df, "\n\n", df1)


res2 = pd.concat([df, df1], axis=1, join='inner')

res2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now we set axes join = outer for union of dataframe which keeps all columns from both DataFrames.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;res2 = pd.concat([df, df1], axis=1, sort=False)
​
res2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Concatenating DataFrames by Ignoring Indexes
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;res = pd.concat([df, df1], ignore_index=True)

res
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Concatenating DataFrame with group keys :
If we want to retain information about the DataFrame from which each row came, we can use the keys argument. This assigns a label to each group of rows based on the source DataFrame.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;frames = [df, df1 ]

res = pd.concat(frames, keys=['x', 'y'])
res
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Concatenating Mixed DataFrames and Series
We can also concatenate a mix of Series and DataFrames. If we include a Series in the list, it will automatically be converted to a DataFrame and we can specify the column name.
&lt;/li&gt;
&lt;/ol&gt;

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

data1 = {'Name':['Jai', 'Princi', 'Gaurav', 'Anuj'],
        'Age':[27, 24, 22, 32],
        'Address':['Nagpur', 'Kanpur', 'Allahabad', 'Kannuaj'],
        'Qualification':['Msc', 'MA', 'MCA', 'Phd']}

df = pd.DataFrame(data1,index=[0, 1, 2, 3])

s1 = pd.Series([1000, 2000, 3000, 4000], name='Salary')

print(df, "\n\n", s1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;res = pd.concat([df, s1], axis=1)

res
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Merging DataFrame&lt;/strong&gt;&lt;br&gt;
Merging DataFrames in Pandas is similar to performing SQL joins. It is useful when we need to combine two DataFrames based on a common column or index. The merge() function provides flexibility for different types of joins.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Merging DataFrames Using One Key
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pandas as pd

data1 = {'key': ['K0', 'K1', 'K2', 'K3'],
         'Name':['Jai', 'Princi', 'Gaurav', 'Anuj'],
        'Age':[27, 24, 22, 32],}

data2 = {'key': ['K0', 'K1', 'K2', 'K3'],
         'Address':['Nagpur', 'Kanpur', 'Allahabad', 'Kannuaj'],
        'Qualification':['Btech', 'B.A', 'Bcom', 'B.hons']}

df = pd.DataFrame(data1)

df1 = pd.DataFrame(data2)


print(df, "\n\n", df1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;res = pd.merge(df, df1, on='key')

res
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Merging DataFrames Using Multiple Keys
We can also merge DataFrames based on more than one column by passing a list of column names to the on argument.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pandas as pd
​
data1 = {'key': ['K0', 'K1', 'K2', 'K3'],
         'key1': ['K0', 'K1', 'K0', 'K1'],
         'Name':['Jai', 'Princi', 'Gaurav', 'Anuj'],
        'Age':[27, 24, 22, 32],}
​
data2 = {'key': ['K0', 'K1', 'K2', 'K3'],
         'key1': ['K0', 'K0', 'K0', 'K0'],
         'Address':['Nagpur', 'Kanpur', 'Allahabad', 'Kannuaj'],
        'Qualification':['Btech', 'B.A', 'Bcom', 'B.hons']}
​
df = pd.DataFrame(data1)
​
df1 = pd.DataFrame(data2)
​
​
print(df, "\n\n", df1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;res1 = pd.merge(df, df1, on=['key', 'key1'])

res1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Merging DataFrames Using the how Argument
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;res = pd.merge(df, df1, how='left', on=['key', 'key1'])

res
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;MERGE METHOD    JOIN NAME   DESCRIPTION&lt;br&gt;
left    LEFT OUTER JOIN Use keys from left frame only&lt;br&gt;
right   RIGHT OUTER JOIN    Use keys from right frame only&lt;br&gt;
outer   FULL OUTER JOIN Use union of keys from both frames&lt;br&gt;
inner   INNER JOIN  Use intersection of keys from both frames&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Joining DataFrame&lt;/strong&gt;&lt;br&gt;
The .join() method in Pandas is used to combine columns of two DataFrames based on their indexes. It's a simple way of merging two DataFrames when the relationship between them is primarily based on their row indexes. It is used when we want to combine DataFrames along their indexes rather than specific columns.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Joining DataFrames Using .join()
If both DataFrames have the same index, we can use the .join() function to combine their columns. This method is useful when we want to merge DataFrames based on their row indexes rather than columns.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;res = df.join(df1)

res
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Pivot Table&lt;br&gt;
&lt;/p&gt;

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

# creating dataframe
df = pd.DataFrame({'Product': ['Carrots', 'Broccoli', 'Banana', 'Banana',
                               'Beans', 'Orange', 'Broccoli', 'Banana'],
                   'Category': ['Vegetable', 'Vegetable', 'Fruit', 'Fruit',
                                'Vegetable', 'Fruit', 'Vegetable', 'Fruit'],
                   'Quantity': [8, 5, 3, 4, 5, 9, 11, 8],
                   'Amount': [270, 239, 617, 384, 626, 610, 62, 90]})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pivot = df.pivot_table(index=['Product'],
                       values=['Amount'],
                       aggfunc='sum')
print(pivot)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pivot = df.pivot_table(index=['Category'],
                       values=['Amount'],
                       aggfunc='sum')
print(pivot)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pivot = df.pivot_table(index=['Product', 'Category'],
                       values=['Amount'], aggfunc='sum')
print(pivot)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pivot = df.pivot_table(index=['Category'], values=['Amount'],
                       aggfunc={'median', 'mean', 'min'})
print(pivot)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pandas Series&lt;/strong&gt;&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
import numpy as np

# creating simple array
data = np.array(['g', 'e', 'e', 'k', 's', 'f',
                 'o', 'r', 'g', 'e', 'e', 'k', 's'])
ser = pd.Series(data)
# retrieve the first element
print(ser[0])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Accessing First 5 Elements of Series&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(ser[:5])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Accessing Last 10 Elements of Series&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(ser[-10:])

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Accessing First 5 Elements of Series&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ser.head(10)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Accessing a Single Element Using index Label&lt;/p&gt;

&lt;p&gt;&lt;code&gt;print(ser[16])&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Accessing a Multiple Element Using index Label&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = np.array(['g', 'e', 'e', 'k', 's', 'f',
                 'o', 'r', 'g', 'e', 'e', 'k', 's'])
ser = pd.Series(data, index=[10, 11, 12, 13, 14,
                             15, 16, 17, 18, 19, 20, 21, 22])
print(ser[[10, 11, 12, 13, 14]])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Access Multiple Elements by Providing Label of Index&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
ser = pd.Series(np.arange(3, 9), index=['a', 'b', 'c', 'd', 'e', 'f'])
print(ser[['a', 'd']])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Working with Missing Data in Pandas&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using isnull()&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;isnull() returns a DataFrame of Boolean value where True represents missing data (NaN). This is simple if we want to find and fill missing data in a dataset.&lt;/p&gt;

&lt;p&gt;Example 1: Finding Missing Values in 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;import pandas as pd
import numpy as np

d = {'First Score': [100, 90, np.nan, 95],
        'Second Score': [30, 45, 56, np.nan],
        'Third Score': [np.nan, 40, 80, 98]}
df = pd.DataFrame(d)

mv = df.isnull()

print(mv)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example 2: Filtering Data Based on Missing Values&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.geeksforgeeks.org/wp-content/uploads/20250311172213344096/employees.csv" rel="noopener noreferrer"&gt;sampleFile&lt;/a&gt;&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
d = pd.read_csv("/content/employees.csv")

bool_series = pd.isnull(d["Gender"])
missing_gender_data = d[bool_series]
print(missing_gender_data)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Filling Missing Values in Pandas&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Following functions allow us to replace missing values with a specified value or use interpolation methods to find the missing data.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using fillna()
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;d = {'First Score': [100, 90, np.nan, 95],
        'Second Score': [30, 45, 56, np.nan],
        'Third Score': [np.nan, 40, 80, 98]}
df = pd.DataFrame(d)

df.fillna(0)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example 2: Fill with Previous Value (Forward Fill)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df.fillna(method='pad')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example 3: Fill with Next Value (Backward Fill)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df.fillna(method='bfill')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example 4: Fill NaN Values with 'No Gender'&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;d["Gender"].fillna('No Gender', inplace = True) 
d[10:25]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Using replace()
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data.replace(to_replace=np.nan, value=-99)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Using interpolate()
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; df.interpolate(method ='linear', limit_direction ='forward')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Dropping Rows with At Least One Null Value
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pandas as pd
import numpy as np

dict = {'First Score': [100, 90, np.nan, 95],
        'Second Score': [30, np.nan, 45, 56],
        'Third Score': [52, 40, 80, 98],
        'Fourth Score': [np.nan, np.nan, np.nan, 65]}
df = pd.DataFrame(dict)

df.dropna()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Dropping Rows with All Null Values
We can drop rows where all values are missing using dropna(how='all').&lt;/li&gt;
&lt;/ol&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;df.dropna(how='all')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Dropping Columns with At Least One Null Value
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df.dropna(axis=1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>datascience</category>
      <category>learning</category>
      <category>python</category>
    </item>
    <item>
      <title>Data Analysis Week 4 Notes</title>
      <dc:creator>Rajasekaran Palraj</dc:creator>
      <pubDate>Sun, 24 Aug 2025 17:36:13 +0000</pubDate>
      <link>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-week-4-notes-lpi</link>
      <guid>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-week-4-notes-lpi</guid>
      <description>&lt;p&gt;Database:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CREATE DATABASE new_db;&lt;/li&gt;
&lt;li&gt;SHOW DATABASES;&lt;/li&gt;
&lt;li&gt;USE new_db&lt;/li&gt;
&lt;li&gt;DROP DATABASE new_db;&lt;/li&gt;
&lt;li&gt;CREATE DATABASE IF NOT EXISTS new_db;&lt;/li&gt;
&lt;li&gt;DROP DATABASE IF EXISTS new_db
mysql&lt;/li&gt;
&lt;li&gt;RENAME TABLE old_database_name.table1 TO new_database_name.table1;&lt;/li&gt;
&lt;li&gt;RENAME TABLE old_database_name.table2 TO new_database_name.table2;
-- Repeat for all tables in the old database
postgres
ALTER DATABASE current_database_name RENAME TO new_database_name;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MSSQl&lt;br&gt;
ALTER DATABASE Test MODIFY NAME = Example&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Troubleshooting Database Rename Issues&lt;/strong&gt;&lt;br&gt;
Database is in Use: If you encounter an error saying that the database is in use, you may need to disconnect active users or close any applications connected to the database before renaming it.&lt;br&gt;
&lt;strong&gt;Insufficient Privileges&lt;/strong&gt;: If you receive a permission error, ensure you have administrative privileges or sufficient rights to modify the database. You might need to check your user role and permissions.&lt;br&gt;
&lt;strong&gt;Database Name Constraints:&lt;/strong&gt; Some DBMSs have restrictions on certain characters or reserved words in database names. Ensure your new database name adheres to the naming conventions for the specific SQL system you are using.&lt;/p&gt;

&lt;p&gt;CREATE TABLE Customer(&lt;br&gt;
    CustomerID INT PRIMARY KEY,&lt;br&gt;
    CustomerName VARCHAR(50),&lt;br&gt;
    LastName VARCHAR(50),&lt;br&gt;
    Country VARCHAR(50),&lt;br&gt;
    Age INT CHECK (Age &amp;gt;= 0 AND Age &amp;lt;= 99),&lt;br&gt;
    Phone int(10)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;CREATE TABLE SubTable AS&lt;br&gt;
SELECT CustomerID, CustomerName&lt;br&gt;
FROM customer;&lt;/p&gt;

&lt;p&gt;CREATE TABLE IF NOT EXISTS Customer&lt;/p&gt;

&lt;p&gt;DESC table_name;&lt;/p&gt;

&lt;p&gt;DROP TABLE IF EXISTS categories;&lt;/p&gt;

&lt;p&gt;SHOW TABLES; (mysql)&lt;/p&gt;

&lt;p&gt;SELECT * FROM INFORMATION_SCHEMA.TABLES(other table)&lt;/p&gt;

&lt;p&gt;ALTER TABLE Student RENAME Column name TO FIRST_NAME;&lt;/p&gt;

&lt;p&gt;ALTER TABLE Student RENAME TO Student_Details;&lt;/p&gt;

&lt;p&gt;ALTER TABLE Student ADD marks INT;&lt;/p&gt;

&lt;p&gt;ALTER TABLE Student_Details&lt;br&gt;
MODIFY COLUMN phone BIGINT;&lt;/p&gt;

&lt;p&gt;ALTER TABLE Student_Details&lt;/p&gt;

&lt;p&gt;DROP COLUMN marks;&lt;/p&gt;

&lt;p&gt;ALTER TABLE Student_Details ALTER COLUMN age SET DEFAULT 18;&lt;/p&gt;

&lt;p&gt;TRUNCATE TABLE EMPLOYEE;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1r720cr81vriu4i931jw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1r720cr81vriu4i931jw.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgvze8i0on1h2cdi6q3ai.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgvze8i0on1h2cdi6q3ai.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SQL Cloning or Copying a Table&lt;/p&gt;

&lt;p&gt;What is a Copying or Cloning Table in SQL&lt;br&gt;
SQL Cloning is an operation that means making a copy of a table. It's like taking a photocopy of a document. This copy can include both the table’s structure (column names, data types, constraints) and optionally its data. The clone table is independent of the original and can be used for testing, backups, or analysis without affecting the original table.&lt;/p&gt;

&lt;p&gt;Cloning a table in SQL means making a duplicate copy of an existing table. It's like making a backup so that we can experiment or work with the data without affecting the original table. This saves our the time and effort of creating a completely new table and re-entering all the same data. Cloning can be done with or without data:&lt;/p&gt;

&lt;p&gt;With Data: The clone table includes the structure and rows of the original table.&lt;br&gt;
Without Data: Only the structure of the original table is copied.&lt;/p&gt;

&lt;p&gt;Methods for Cloning Tables in SQL&lt;br&gt;
There are three different methods to create a clone table in SQL:&lt;/p&gt;

&lt;p&gt;Simple Cloning&lt;br&gt;
Deep Cloning&lt;br&gt;
Shallow Cloning&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Simple Cloning
In this method, the clone table creates a copy of the original table’s structure and data, but constraints like primary keys, unique keys, and auto-increment properties are not preserved.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE STUDENT_COPY AS SELECT * FROM STUDENT;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Shallow Cloning
Shallow cloning is the method in which the clone table gets the same structure as the original table but it does not inherits or copy the data from the original table. In other words, we will have the empty table including indices such as primary key, unique key, and auto_increment. It also preserves constraints like primary keys and unique keys.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE STUDENT_SHALLOW_CLONE LIKE STUDENT;
SELECT * FROM STUDENT_SHALLOW_CLONE;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Deep Cloning
This method is widely used for creating the clone tables in SQL as it inherits all the properties of original table including indices such as primary key, unique, and auto_increment as well as inherits the existing data from the original table.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE STUDENT_DEEP_CLONE LIKE STUDENT;
INSERT INTO STUDENT_DEEP_CLONE SELECT * FROM STUDENT;
SELECT * FROM STUDENT_DEEP_CLONE;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What is Temporary Table in SQL?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A temporary table in SQL is an important tool for maintaining intermediate results during query execution. They help store temporary data without affecting the underlying permanent tables.&lt;/p&gt;

&lt;p&gt;CREATE TABLE #EmpDetails (id INT, name VARCHAR(25))  &lt;/p&gt;

&lt;p&gt;SELECT * FROM Emp1 WHERE Age=24;&lt;/p&gt;

&lt;p&gt;SELECT * FROM Customer;&lt;/p&gt;

&lt;p&gt;SELECT CustomerName &lt;br&gt;
FROM Customer &lt;br&gt;
where Age = '21'; &lt;/p&gt;

&lt;p&gt;SELECT Customer_id, COUNT(*) AS order_count&lt;br&gt;
FROM Orders&lt;br&gt;
GROUP BY Customer_id;&lt;/p&gt;

&lt;p&gt;SELECT Department, sum(Salary) as Salary&lt;br&gt;
FROM employee&lt;br&gt;
GROUP BY department&lt;br&gt;
HAVING SUM(Salary) &amp;gt;= 50000; &lt;/p&gt;

&lt;p&gt;SELECT * FROM Customer ORDER BY Age DESC;  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;INSERT&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;INSERT INTO table_name &lt;br&gt;
VALUES (value1, value2, value); &lt;/p&gt;

&lt;p&gt;INSERT INTO Student (ROLL_NO, NAME, AGE, ADDRESS, PHONE) &lt;br&gt;
VALUES&lt;br&gt;
(6, 'Amit Kumar', 15, 'Delhi', 'XXXXXXXXXX'),&lt;br&gt;
(7, 'Gauri Rao', 18, 'Bangalore', 'XXXXXXXXXX'),&lt;br&gt;
(8, 'Manav Bhatt', 17, 'New Delhi', 'XXXXXXXXXX'),&lt;br&gt;
(9, 'Riya Kapoor', 10, 'Udaipur', 'XXXXXXXXXX');&lt;/p&gt;

&lt;p&gt;INSERT INTO target_table&lt;br&gt;
SELECT * FROM source_table;&lt;/p&gt;

&lt;h1&gt;
  
  
  specific columns
&lt;/h1&gt;

&lt;p&gt;INSERT INTO Students (Name, Age)&lt;br&gt;
SELECT Name, Age&lt;br&gt;
FROM OldStudents;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inserting Data Using Transactions&lt;/strong&gt;&lt;br&gt;
When inserting large amounts of data, you can use SQL transactions to ensure that all rows are inserted correctly. A transaction groups multiple SQL operations into a single unit, so if one operation fails, the entire transaction is rolled back.&lt;/p&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;`BEGIN TRANSACTION;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSERT INTO Customers (CustomerID, CustomerName, ContactName, Country)
VALUES (5, 'Sarah White', 'John White', 'Canada');

INSERT INTO Customers (CustomerID, CustomerName, ContactName, Country)
VALUES (6, 'Mohamed Ibrahim', 'Ahmed Ibrahim', 'UAE');

-- If any error occurs, the transaction will be rolled back
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;COMMIT;`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;UPDATE Customer &lt;br&gt;
SET CustomerName  = 'Nitin' &lt;br&gt;
WHERE Age = 22;&lt;/p&gt;

&lt;p&gt;UPDATE Customer &lt;br&gt;
SET CustomerName = 'Satyam', &lt;br&gt;
Country = 'USA' &lt;br&gt;
WHERE CustomerID = 1;&lt;/p&gt;

&lt;p&gt;If we accidentally omit the WHERE clause, all the rows in the table will be updated, which is a common mistake. Let’s update the CustomerName for every record in the table:&lt;/p&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;UPDATE Customer &lt;br&gt;
SET CustomerName = 'Shubham';&lt;/p&gt;

&lt;p&gt;Best Practices for Using SQL UPDATE Statement&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Always use the WHERE clause:&lt;br&gt;
The most important point when using the UPDATE statement is to always include a WHERE clause unless you genuinely intend to update all rows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check your data before updating:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Run a SELECT query to view the data you want to update before executing the UPDATE statement. This helps avoid accidental data modifications.&lt;/p&gt;

&lt;p&gt;SELECT * FROM Customer WHERE Age = 22;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use transactions for critical updates:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When performing updates in a production environment, consider using transactions. Transactions allow you to commit or roll back changes as needed.&lt;/p&gt;

&lt;p&gt;BEGIN TRANSACTION;&lt;br&gt;
UPDATE Customer SET CustomerName = 'John' WHERE CustomerID = 3;&lt;br&gt;
COMMIT;  -- Use ROLLBACK to undo if necessary&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Test on a small dataset first: If you are uncertain about the impact of your UPDATE, test it on a small subset of data to ensure the changes are as expected.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;delete&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;DELETE FROM GFG_Employees &lt;br&gt;
WHERE NAME = 'Rithvik'; &lt;/p&gt;

&lt;p&gt;delete All records from table&lt;/p&gt;

&lt;p&gt;DELETE FROM GFG_Employees;&lt;br&gt;
Or&lt;br&gt;
DELETE * FROM GFG_Employees; &lt;/p&gt;

&lt;p&gt;START TRANSACTION;&lt;br&gt;
DELETE FROM GFG_Employees WHERE department = 'Development';&lt;br&gt;
-- If needed, you can rollback the deletion&lt;br&gt;
ROLLBACK;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Are Duplicate Rows?&lt;/strong&gt;&lt;br&gt;
Duplicate rows are records in a database that have identical values in one or more columns. These rows often arise due to issues like multiple imports, user errors, or missing constraints like primary keys or unique indexes. SQL query to delete duplicate rows typically involves identifying duplicates using functions like ROW_NUMBER() or COUNT() and making sure that only one copy of each record is kept in the table. If not handled properly, duplicates can lead to:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inaccurate Data Reporting:&lt;/strong&gt; Reports may contain false information.&lt;br&gt;
&lt;strong&gt;Storage Waste:&lt;/strong&gt; Redundant records consume unnecessary space.&lt;br&gt;
Decreased Query Performance: Queries on large tables with duplicates may perform poorly.&lt;br&gt;
Why You Should Remove Duplicate Rows&lt;br&gt;
&lt;strong&gt;Data Integrity:&lt;/strong&gt; Duplicates can distort reports and analyses, leading to incorrect insights.&lt;br&gt;
Optimal Performance: Redundant data can slow down queries, especially when dealing with large datasets.&lt;br&gt;
&lt;strong&gt;Efficient Storage:&lt;/strong&gt; Removing duplicates helps optimize storage usage, keeping your database lean.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best Practices to Prevent Duplicates&lt;/strong&gt;&lt;br&gt;
While identifying and removing duplicates is essential, preventing them is even better. Here are some best practices to ensure that duplicates don’t enter your database in the first place:&lt;/p&gt;

&lt;p&gt;Use Primary Keys or Unique Constraints: These ensure that each record is unique, preventing accidental duplication.&lt;br&gt;
Data Validation: Implement validation rules in your application to prevent duplicate entries.&lt;br&gt;
Indexing: Create unique indexes on columns that must remain unique, like contact numbers or email addresses.&lt;br&gt;
Regular Data Cleaning: Periodically run data-cleaning queries to identify and remove any newly inserted duplicates.&lt;/p&gt;

&lt;p&gt;SELECT DATE_FORMAT('2025-08-20 08:30:00', '%W, %M %D, %Y %r');&lt;br&gt;
-- Output: Wednesday, August 20th, 2025 08:30:00 AM&lt;br&gt;
Common format specifiers include:&lt;br&gt;
%Y: Four-digit year&lt;br&gt;
%y: Two-digit year&lt;br&gt;
%M: Full month name (January-December)&lt;br&gt;
%m: Numeric month (01-12)&lt;br&gt;
%b: Abbreviated month name (Jan-Dec)&lt;br&gt;
%D: Day of the month with English suffix (1st, 2nd, 3rd, etc.)&lt;br&gt;
%d: Numeric day of the month (01-31)&lt;br&gt;
%W: Full weekday name (Sunday-Saturday)&lt;br&gt;
%w: Numeric weekday (0=Sunday, 6=Saturday)&lt;br&gt;
%H: Hour (00-23)&lt;br&gt;
%h: Hour (01-12)&lt;br&gt;
%i: Minutes (00-59)&lt;br&gt;
%s: Seconds (00-59)&lt;br&gt;
%f: Microseconds (000000-999999)&lt;br&gt;
%r: Time in 12-hour format with AM/PM (hh:mm:ss AM/PM)&lt;/p&gt;

&lt;p&gt;SELECT CURTIME();&lt;/p&gt;

&lt;p&gt;SELECT CURDATE()&lt;/p&gt;

&lt;p&gt;Types of MySQL JOIN&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;INNER JOIN&lt;/li&gt;
&lt;li&gt;LEFT JOIN&lt;/li&gt;
&lt;li&gt;RIGHT JOIN&lt;/li&gt;
&lt;li&gt;FULL JOIN&lt;/li&gt;
&lt;li&gt;CROSS JOIN&lt;/li&gt;
&lt;li&gt;Self Join&lt;/li&gt;
&lt;li&gt;Update JOin&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;UPDATE students&lt;br&gt;
JOIN courses ON students.course_id = courses.course_id&lt;br&gt;
JOIN grades ON students.student_id = grades.student_id&lt;br&gt;
SET grades.grade = grades.grade + 5&lt;br&gt;
WHERE courses.course_name = 'Science';&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Delete Join&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;DELETE emp FROM employees emp&lt;br&gt;
JOIN salaries sal ON emp.employee_id = sal.employee_id&lt;br&gt;
WHERE sal.salary &amp;lt; 50000;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Window Functions in SQL&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;SQL window functions are essential for advanced data analysis and database management. It is a type of function that allows us to perform calculations across a specific set of rows related to the current row. These calculations happen within a defined window of data and they are particularly useful for aggregates, rankings and cumulative totals without modifying the dataset.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Window Functions in SQL&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;aggregate window functions&lt;/li&gt;
&lt;li&gt;ranking window functions&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Aggregate Window Function
Aggregate window functions calculate aggregates over a window of rows while retaining individual rows. Common aggregate functions include:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;SUM(): Sums values within a window.&lt;br&gt;
AVG(): Calculates the average value within a window.&lt;br&gt;
COUNT(): Counts the rows within a window.&lt;br&gt;
MAX(): Returns the maximum value in the window.&lt;br&gt;
MIN(): Returns the minimum value in the window.&lt;br&gt;
LAG()/LEAD()&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ranking Window Functions
These functions provide rankings of rows within a partition based on specific criteria. Common ranking functions include:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;RANK(): Assigns ranks to rows, skipping ranks for duplicates.&lt;br&gt;
DENSE_RANK(): Assigns ranks to rows without skipping rank numbers for duplicates.&lt;br&gt;
ROW_NUMBER(): Assigns a unique number to each row in the result set.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;CASE Statements in SQL&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;CASE lets you add conditional logic inside queries.&lt;/p&gt;

&lt;p&gt;✅ Example 1: Simple CASE&lt;br&gt;
SELECT emp_id,&lt;br&gt;
       first_name,&lt;br&gt;
       salary,&lt;br&gt;
       CASE &lt;br&gt;
           WHEN salary &amp;gt;= 100000 THEN 'High'&lt;br&gt;
           WHEN salary BETWEEN 60000 AND 99999 THEN 'Medium'&lt;br&gt;
           ELSE 'Low'&lt;br&gt;
       END AS salary_band&lt;br&gt;
FROM Employees;&lt;/p&gt;

&lt;p&gt;👉 Categorizes employees into salary bands.&lt;/p&gt;

&lt;p&gt;✅ Example 2: CASE inside ORDER BY&lt;br&gt;
SELECT emp_id, first_name, dept_id&lt;br&gt;
FROM Employees&lt;br&gt;
ORDER BY &lt;br&gt;
    CASE &lt;br&gt;
        WHEN dept_id = 1 THEN 1&lt;br&gt;
        WHEN dept_id = 2 THEN 2&lt;br&gt;
        ELSE 3&lt;br&gt;
    END;&lt;/p&gt;

&lt;p&gt;👉 Custom sorting (Dept 1 first, then Dept 2, then others).&lt;/p&gt;

&lt;p&gt;✅ Example 3: CASE inside WHERE&lt;br&gt;
SELECT emp_id, first_name, salary, dept_id&lt;br&gt;
FROM Employees&lt;br&gt;
WHERE salary &amp;gt;&lt;br&gt;
      CASE &lt;br&gt;
          WHEN dept_id = 1 THEN 70000&lt;br&gt;
          WHEN dept_id = 2 THEN 50000&lt;br&gt;
          ELSE 40000&lt;br&gt;
      END;&lt;/p&gt;

&lt;p&gt;Type Indexes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clustered index&lt;/li&gt;
&lt;li&gt;Non-clustered index&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Clustered Index&lt;/strong&gt;&lt;br&gt;
A clustered index is the type of indexing that establishes a physical sorting order of rows. The data rows are stored directly in the order of the indexed column(s). Each table can have only one clustered index because it dictates the data’s physical storage. A clustered index is like a Dictionary in which the sorting order is alphabetical and there is no separate index page. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Non-Clustered Index&lt;/strong&gt;&lt;br&gt;
Non-Clustered index is an index structure separate from the data stored in a table that reorders one or more selected columns. The non-clustered index is created to improve the performance of frequently used queries not covered by a clustered index. It's like a textbook, the index page is created separately at the beginning of that book.&lt;/p&gt;

&lt;p&gt;Other Index types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unique Index&lt;/li&gt;
&lt;li&gt;Composite (or Compound) Index&lt;/li&gt;
&lt;li&gt;Filtered Index(mysql wont support)&lt;/li&gt;
&lt;li&gt;Columnstore Index&lt;/li&gt;
&lt;li&gt;Hash Index&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Data Normalization:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flquqksm94jmmd4eciy2c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flquqksm94jmmd4eciy2c.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyw041i04zuhdypy2ri0e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyw041i04zuhdypy2ri0e.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7u10veyjr4zko6nxy5bd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7u10veyjr4zko6nxy5bd.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ACID Properties&lt;/p&gt;

&lt;p&gt;Transactions are fundamental operations that allow us to modify and retrieve data. However, to ensure the integrity of a database, it is important that these transactions are executed in a way that maintains consistency, correctness, and reliability even in case of failures / errors. This is where the ACID properties come into play.&lt;/p&gt;

&lt;p&gt;ACID stands for Atomicity, Consistency, Isolation, and Durability.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Data Analysis Week 3 Notes</title>
      <dc:creator>Rajasekaran Palraj</dc:creator>
      <pubDate>Thu, 14 Aug 2025 17:24:07 +0000</pubDate>
      <link>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-week-3-notes-4e6d</link>
      <guid>https://dev.to/raja_sekaran_a1319259e6f1/data-analysis-week-3-notes-4e6d</guid>
      <description>&lt;p&gt;&lt;strong&gt;Structured Query Language (SQL)&lt;/strong&gt; is the standard language used to interact with relational databases.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mainly used to manage data. Whether you want to create, delete, update or read data, SQL provides the structure and commands to perform these operations.&lt;/li&gt;
&lt;li&gt;Widely supported across various database systems like MySQL, Oracle, PostgreSQL, SQL Server and many others.&lt;/li&gt;
&lt;li&gt;Mainly works with Relational Databases (data is stored in the form of tables)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After your MySQL environment is set up, you can write your SQL program. Below is the example to display " Hello World" using SQL.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a database named test_db
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE DATABASE test_db;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Use the test_db database
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;USE test_db;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Create a table named greetings
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE greetings (
    id INT AUTO_INCREMENT PRIMARY KEY,
    message VARCHAR(255)
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Insert the message 'Hello, World!' into the greetings table
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSERT INTO greetings (message)
VALUES ('Hello, World!');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Retrieve the message from the greetings table
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT message FROM greetings;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why Learn SQL?&lt;/strong&gt;&lt;br&gt;
SQL's integration with various technologies makes it essential for managing and querying data in databases. Whether it is in traditional relational databases (RDBMS) or modern technologies such as machine learning, AI and blockchain, SQL plays a key role. It works effortlessly with DBMS to help users interact with data, whether stored in structured RDBMS or other types of databases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Science &amp;amp; Analytics:&lt;/strong&gt; Used for querying large datasets, data cleaning and analysis. Analysts use SQL to generate reports and insights that inform business decisions.&lt;br&gt;
&lt;strong&gt;Machine Learning &amp;amp; AI&lt;/strong&gt;: Helps in preparing and managing the data required for training machine learning models and AI algorithms. It is used for data cleaning, transformation, and extraction.&lt;br&gt;
&lt;strong&gt;Web Development&lt;/strong&gt;: Used to manage user data, e-commerce transactions, and content management in websites and applications built with frameworks like Django, Node.js, and Ruby on Rails.&lt;br&gt;
Cloud and Big Data: SQL is integrated into cloud-based databases (e.g., Amazon RDS, Microsoft Azure SQL) and Big Data platforms (e.g., Apache Hive) to enable seamless data querying and management.&lt;br&gt;
&lt;strong&gt;Blockchain and Decentralized Systems:&lt;/strong&gt; In blockchain systems, SQL can be used to manage off-chain data, providing efficient data storage and retrieval alongside decentralized ledger technology&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SQL&lt;/strong&gt;&lt;br&gt;
Structured Query Language (SQL) is the standard language used to interact with relational databases.&lt;/p&gt;

&lt;p&gt;Allows users to store, retrieve, update, and manage data efficiently through simple commands.&lt;br&gt;
Known for its user-friendly syntax and powerful capabilities, SQL is widely used across industries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Does SQL Work?&lt;/strong&gt;&lt;br&gt;
We interact with databases using SQL queries.&lt;br&gt;
SQL Engine breaks down, optimizes and executes these queries efficiently&lt;br&gt;
DBMS tools like MySQL and SQL Server have their own SQL engine and an interface where users can write and execute SQL queries..&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Components of a SQL System&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Databases&lt;/strong&gt; : A database is a structured collection of data. It organizes data into tables, which are like spreadsheets with rows (records) and columns (fields) .&lt;br&gt;
&lt;strong&gt;Tables&lt;/strong&gt;: Each table enforces rules and relationships among its columns for data integrity.&lt;br&gt;
&lt;strong&gt;Indexes&lt;/strong&gt;: Indexes speed up queries by allowing the database to quickly locate data without scanning the entire table.&lt;br&gt;
&lt;strong&gt;Views&lt;/strong&gt;: A view is a virtual table—basically a saved SELECT statement you can query like a table.&lt;br&gt;
&lt;strong&gt;Stored Procedures&lt;/strong&gt;: These are pre-written SQL scripts stored inside the database. They can receive inputs, run complex logic, and return results boosting performance, reusability, and security.&lt;br&gt;
&lt;strong&gt;Transactions&lt;/strong&gt;: A transaction groups multiple SQL operations into a single unit. It ensures all changes are applied successfully or none are, preserving data integrity (ACID properties)&lt;br&gt;
Security &amp;amp; Permissions: SQL includes tools to restrict access, letting DBAs assign who can do what whether it's accessing tables, executing procedures, or changing structures.&lt;br&gt;
&lt;strong&gt;Joins&lt;/strong&gt;: Joins combine data from multiple tables based on relationships essential for querying across related datasets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rules for Writing SQL Queries&lt;/strong&gt;&lt;br&gt;
There are certain rules for SQL which would ensure consistency and functionality across databases. By following these rules, queries will be well formed and well executed in any database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;End with Semicolon (;)&lt;/strong&gt;: Each SQL statement must end with a semicolon to execute properly.&lt;br&gt;
&lt;strong&gt;Case Insensitivity:&lt;/strong&gt; SQL keywords (e.g., SELECT, INSERT) are not case-sensitive. However, table/column names may be case-sensitive depending on the DBMS.&lt;br&gt;
&lt;strong&gt;Whitespace Allowed:&lt;/strong&gt; Queries can span multiple lines, but use spaces between keywords and names.&lt;br&gt;
&lt;strong&gt;Reserved Words:&lt;/strong&gt; Avoid using SQL keywords as names. If needed, wrap them in quotes (" ") or backticks (`).&lt;/p&gt;

&lt;p&gt;What are Different SQL Commands or Queries?&lt;br&gt;
Structured Query Language (SQL) commands are standardized instructions used by developers to interact with data stored in relational databases. These commands allow for the creation, manipulation, retrieval and control of data, as well as database structures. SQL commands are categorized based on their specific functionalities:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhs7v1iqb1vw63gs2ys79.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhs7v1iqb1vw63gs2ys79.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SQL Data Types&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In SQL, each column must be assigned a data type that defines the kind of data it can store, such as integers, dates, text, or binary values. Choosing the correct data type is crucial for data integrity, query performance and efficient indexing.&lt;/p&gt;

&lt;p&gt;Benefits of using the right data type:&lt;/p&gt;

&lt;p&gt;Memory-efficient storage&lt;br&gt;
Accurate operations (e.g., calculations, sorting)&lt;br&gt;
Consistency in stored values&lt;br&gt;
Validation of input data&lt;br&gt;
SQL data types are broadly categorized into several groups&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw0srlrmrnh5zczzx7ujd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw0srlrmrnh5zczzx7ujd.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Numeric Data Types&lt;/strong&gt;&lt;br&gt;
Numeric data types are fundamental to database design and are used to store numbers, whether they are integers, decimals or floating-point numbers. These data types allow for mathematical operations like addition, subtraction, multiplication and division, which makes them essential for managing financial, scientific and analytical data.&lt;/p&gt;

&lt;p&gt;Data Type   Description Range&lt;br&gt;
&lt;strong&gt;BIGINT&lt;/strong&gt;  Large integer numbers   -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807&lt;br&gt;
&lt;strong&gt;INT&lt;/strong&gt; Standard integer values -2,147,483,648 to 2,147,483,647&lt;br&gt;
&lt;strong&gt;SMALLINT&lt;/strong&gt;    Small integers  -32,768 to 32,767&lt;br&gt;
&lt;strong&gt;TINYINT&lt;/strong&gt; Very small integers 0 to 255&lt;br&gt;
&lt;strong&gt;DECIMAL&lt;/strong&gt; Exact fixed-point numbers (e.g., for financial values)  -10^38 + 1 to 10^38 - 1&lt;br&gt;
&lt;strong&gt;NUMERIC&lt;/strong&gt; Similar to DECIMAL, used for precision data -10^38 + 1 to 10^38 - 1&lt;br&gt;
&lt;strong&gt;MONEY&lt;/strong&gt;   For storing monetary values -922,337,203,685,477.5808 to 922,337,203,685,477.5807&lt;br&gt;
&lt;strong&gt;SMALLMONEY&lt;/strong&gt;  Smaller monetary values -214,748.3648 to 214,748.3647&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Approximate Numeric Datatype&lt;/strong&gt;&lt;br&gt;
These types are used to store approximate values, such as scientific measurements or large ranges of data that don't need exact precision.&lt;/p&gt;

&lt;p&gt;Data Type   Description Range&lt;br&gt;
&lt;strong&gt;FLOAT&lt;/strong&gt;   Approximate numeric values  -1.79E+308 to 1.79E+308&lt;br&gt;
&lt;strong&gt;REAL&lt;/strong&gt;    Similar to FLOAT, but with less precision   -3.40E+38 to 3.40E+38&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Character and String Data Types&lt;/strong&gt;&lt;br&gt;
Character data types are used to store text or character-based data. The choice between fixed-length and variable-length data types depends on the nature of your data.&lt;/p&gt;

&lt;p&gt;Data Type   Description&lt;br&gt;
&lt;strong&gt;Char&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;The maximum length of 8000 characters. (Fixed-Length non-Unicode Characters)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Varchar&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The maximum length of 8000 characters. (Variable-Length non-Unicode Characters)&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Varchar(max)&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
The maximum length of 2^31 - 1 characters(SQL Server 2005 only). (Variable Length non-Unicode data)&lt;/p&gt;

&lt;p&gt;Text&lt;/p&gt;

&lt;p&gt;The maximum length of 2,127,483,647 characters(Variable Length non-Unicode data)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unicode Character String Data Types&lt;/strong&gt;&lt;br&gt;
Unicode data types are used to store characters from any language, supporting a wider variety of characters. These are given in below table.&lt;/p&gt;

&lt;p&gt;Data Type&lt;/p&gt;

&lt;p&gt;Description&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nchar&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The maximum length of 4000 characters(Fixed-Length Unicode Characters)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nvarchar&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The maximum length of 4000 characters.(Variable-Length Unicode Characters)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nvarchar(max)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The maximum length of 2^31 - 1 characters(SQL Server 2005 only). (Variable Length Unicode data)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Date and Time Data Type&lt;/strong&gt;&lt;br&gt;
SQL provides several data types for storing date and time information. They are essential for managing timestamps, events and time-based queries. These are given in the below table.&lt;/p&gt;

&lt;p&gt;Data Type   Description &lt;br&gt;
Storage Size&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DATE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;stores the data of date (year, month, day)&lt;/p&gt;

&lt;p&gt;3 Bytes&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TIME&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;stores the data of time (hour, minute,second)&lt;/p&gt;

&lt;p&gt;3 Bytes&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DATETIME&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;store both the data and time (year, month, day, hour, minute, second)&lt;/p&gt;

&lt;p&gt;8 Bytes&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Binary Data Types in SQL&lt;/strong&gt;&lt;br&gt;
Binary data types are used to store binary data such as images, videos or other file types. These include:&lt;/p&gt;

&lt;p&gt;Data Type   Description Max Length&lt;br&gt;
&lt;strong&gt;Binary&lt;/strong&gt;  Fixed-length binary data.   8000 bytes&lt;br&gt;
&lt;strong&gt;VarBinary&lt;/strong&gt;   Variable-length binary data.    8000 bytes&lt;br&gt;
&lt;strong&gt;Image&lt;/strong&gt;   Stores binary data as images.   2,147,483,647 bytes&lt;br&gt;
&lt;strong&gt;5. Boolean Data Type in SQ&lt;/strong&gt;L&lt;br&gt;
The &lt;strong&gt;BOOLEAN&lt;/strong&gt; data types are used to store logical values, typically TRUE or FALSE. It is commonly used for flag fields or binary conditions.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Special Data Types&lt;/strong&gt;
SQL also supports some specialized data types for advanced use cases:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;XML Data Type:&lt;/strong&gt; Used to store XML data and manipulate XML structures in the database&lt;br&gt;
&lt;strong&gt;Spatial Data Type (Geometry):&lt;/strong&gt; stores planar spatial data, such as points, lines, and polygons, in a database table.&lt;/p&gt;

&lt;h2&gt;
  
  
  SQL Operators
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Types of SQL Operators&lt;/strong&gt;&lt;br&gt;
SQL operators can be categorized based on the type of operation they perform. Here are the primary types of SQL operators:&lt;/p&gt;

&lt;p&gt;Arithmetic Operator&lt;br&gt;
Comparison Operator&lt;br&gt;
Logical Operator&lt;br&gt;
Bitwise Operators&lt;br&gt;
Compound Operators&lt;br&gt;
Special Operators&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SQL Arithmetic Operators&lt;/strong&gt;&lt;br&gt;
Arithmetic operators in SQL are used to perform mathematical operations on numeric data types in SQL queries. Some common arithmetic operators:&lt;/p&gt;

&lt;p&gt;Example: Arithmetic Operations&lt;br&gt;
In this example, we calculates a 5% increment on employee salaries and returns both the original and updated salary values.&lt;/p&gt;

&lt;p&gt;Query:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SELECT emp_salary, emp_salary * 1.05 AS "Revised Salary" FROM employee;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;SQL Comparison Operators&lt;br&gt;
Comparison Operators in SQL are used to compare one expression's value to other expressions. SQL supports different types of comparison operator,&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SELECT * FROM MATHS WHERE MARKS=50;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SQL Logical Operators&lt;/strong&gt;&lt;br&gt;
Logical Operators in SQL are used to combine or manipulate conditions in SQL queries to retrieve or manipulate data based on specified criteria..&lt;/p&gt;

&lt;p&gt;Operator    Description&lt;br&gt;
&lt;strong&gt;AND&lt;/strong&gt; &lt;br&gt;
Logical AND compares two Booleans as expressions and returns true when both expressions are true.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OR&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Logical OR compares two Booleans as expressions and returns true when one of the expressions is true.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOT&lt;/strong&gt; &lt;br&gt;
Not takes a single Boolean as an argument and change its value from false to true or from true to false.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SELECT * FROM employee &lt;br&gt;
WHERE emp_city = 'Allahabad' AND emp_country = 'India';&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SQL Bitwise Operators&lt;/strong&gt;&lt;br&gt;
Bitwise operators in SQL are used to perform bitwise operations on binary values in SQL queries, manipulating individual bits to perform logical operations at the bit level. Some SQL Bitwise Operators are:&lt;/p&gt;

&lt;p&gt;Operator&lt;/p&gt;

&lt;p&gt;Description&lt;/p&gt;

&lt;p&gt;&amp;amp;&lt;/p&gt;

&lt;p&gt;Bitwise AND operator&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Bitwise OR operator&lt;/p&gt;

&lt;p&gt;^&lt;/p&gt;

&lt;p&gt;Bitwise XOR (exclusive OR) operator&lt;/p&gt;

&lt;p&gt;~&lt;/p&gt;

&lt;p&gt;Bitwise NOT (complement) operator&lt;/p&gt;

&lt;p&gt;&amp;lt;&amp;lt;&lt;/p&gt;

&lt;p&gt;Left shift operator&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;p&gt;Right shift operator&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SQL Compound Operators&lt;/strong&gt;&lt;br&gt;
Compound operators combine an operation with assignment. These operators modify the value of a column and store the result in the same column in a single step. Some Compound operators are:&lt;/p&gt;

&lt;p&gt;Operator&lt;/p&gt;

&lt;p&gt;Description&lt;/p&gt;

&lt;p&gt;+=&lt;/p&gt;

&lt;p&gt;Add and assign&lt;/p&gt;

&lt;p&gt;-=&lt;/p&gt;

&lt;p&gt;Subtract and assign&lt;/p&gt;

&lt;p&gt;*=&lt;/p&gt;

&lt;p&gt;Multiply and assign&lt;/p&gt;

&lt;p&gt;/=&lt;/p&gt;

&lt;p&gt;Divide and assign&lt;/p&gt;

&lt;p&gt;%=&lt;/p&gt;

&lt;p&gt;Modulo and assign&lt;/p&gt;

&lt;p&gt;&amp;amp;=&lt;/p&gt;

&lt;p&gt;Bitwise AND and assign&lt;/p&gt;

&lt;p&gt;^=&lt;/p&gt;

&lt;p&gt;Bitwise XOR and assign&lt;/p&gt;

&lt;p&gt;|=&lt;/p&gt;

&lt;p&gt;Bitwise OR and assign&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SQL Special Operators&lt;/strong&gt;&lt;br&gt;
SQL also provides several special operators that serve specific functions such as filtering data based on a range, checking for existence, and comparing sets of values.&lt;/p&gt;

&lt;p&gt;Operators   Description &lt;br&gt;
ALL&lt;br&gt;&lt;br&gt;
ALL is used to select all records of a SELECT STATEMENT. It compares a value to every value in a list of results from a query. The ALL must be preceded by the comparison operators and evaluated to TRUE if the query returns no rows.&lt;/p&gt;

&lt;p&gt;ANY &lt;br&gt;
ANY compares a value to each value in a list of results from a query and evaluates to true if the result of an inner query contains at least one row.&lt;/p&gt;

&lt;p&gt;BETWEEN &lt;br&gt;
The SQL BETWEEN operator tests an expression against a range. The range consists of a beginning, followed by an AND keyword and an end expression.&lt;/p&gt;

&lt;p&gt;IN&lt;br&gt;&lt;br&gt;
The IN operator checks a value within a set of values separated by commas and retrieves the rows from the table that match.&lt;/p&gt;

&lt;p&gt;EXISTS&lt;br&gt;&lt;br&gt;
The EXISTS checks the existence of a result of a subquery. The EXISTS subquery tests whether a subquery fetches at least one row. When no data is returned then this operator returns 'FALSE'.  &lt;/p&gt;

&lt;p&gt;SOME    SOME operator evaluates the condition between the outer and inner tables and evaluates to true if the final result returns any one row. If not, then it evaluates to false.&lt;br&gt;
UNIQUE  The UNIQUE operator searches every unique row of a specified table.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Data Analytics Week 2 Notes</title>
      <dc:creator>Rajasekaran Palraj</dc:creator>
      <pubDate>Wed, 06 Aug 2025 16:56:47 +0000</pubDate>
      <link>https://dev.to/raja_sekaran_a1319259e6f1/data-analytics-week-2-notes-mbj</link>
      <guid>https://dev.to/raja_sekaran_a1319259e6f1/data-analytics-week-2-notes-mbj</guid>
      <description>&lt;h2&gt;
  
  
  Python
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Programming Language Types&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Low-level Language&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OS development&lt;/li&gt;
&lt;li&gt;Embedded system&lt;/li&gt;
&lt;li&gt;Device drivers&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;High-level Language&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Ways of high-level Language Execution&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compiler

&lt;ul&gt;
&lt;li&gt;C, C++, java&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Interpreter

&lt;ul&gt;
&lt;li&gt;Execute line by line
Python, perl, metlab&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Programming Language Components&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data types&lt;/li&gt;
&lt;li&gt;Variables&lt;/li&gt;
&lt;li&gt;Operators&lt;/li&gt;
&lt;li&gt;Control Structurs&lt;/li&gt;
&lt;li&gt;Libraries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Python Features&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple and Readable&lt;/li&gt;
&lt;li&gt;Run seamlessly on all operating Systems&lt;/li&gt;
&lt;li&gt;Data Science, Automation and AI &lt;/li&gt;
&lt;li&gt;Libray support &lt;/li&gt;
&lt;li&gt;Used by big companies like google , Netflix, Nasa&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Data Types:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqxv3niiogfm8cka8yv6m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqxv3niiogfm8cka8yv6m.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;1. Numeric Data Types *&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integers - This value is represented by int class. It contains positive or negative whole numbers (without fractions or decimals). In Python, there is no limit to how long an integer value can be.&lt;/li&gt;
&lt;li&gt;Float - This value is represented by the float class. It is a real number with a floating-point representation. It is specified by a decimal point. Optionally, the character e or E followed by a positive or negative integer may be appended to specify scientific notation.&lt;/li&gt;
&lt;li&gt;Complex Numbers - A complex number is represented by a complex class. It is specified as (real part) + (imaginary part)j . For example - 2+3j&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Sequence Data Types&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;String  - arrays of bytes representing Unicode characters&lt;/li&gt;
&lt;li&gt;List - ordered collection of data with similar or different data type (Mutable)&lt;/li&gt;
&lt;li&gt;Tuple - ordered collection of data with similar or different data type (ImMutable)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Boolean Data Type&lt;/strong&gt;&lt;br&gt;
Python Data type with one of the two built-in values&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;True&lt;/li&gt;
&lt;li&gt;False&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Set Data Type&lt;/strong&gt;&lt;br&gt;
It is an unordered collection of data types that is iterable, mutable, and has no duplicate elements.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;5. Dictionary Data *&lt;/em&gt;&lt;br&gt;
A dictionary in Python is a collection of data values, used to store data values like a map, unlike other Python Data Types that hold only a single value as an element, a Dictionary holds a key: value pair. Key-value is provided in the dictionary to make it more optimized.&lt;/p&gt;
&lt;h2&gt;
  
  
  Operators
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operators&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;+, -, *, /, %&lt;/td&gt;
&lt;td&gt;Arithmetic operator&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;lt;, &amp;lt;=, &amp;gt;, &amp;gt;=, ==, !=&lt;/td&gt;
&lt;td&gt;Relational operator&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AND, OR, NOT&lt;/td&gt;
&lt;td&gt;Logical operator&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;amp;,&lt;/td&gt;
&lt;td&gt;, &amp;lt;&amp;lt;, &amp;gt;&amp;gt;, ~, ^&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;=, +=, -=, *=, %=&lt;/td&gt;
&lt;td&gt;Assignment operator&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Flow Control Statements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Conditional Statements (if, elif, else, Match case)&lt;/li&gt;
&lt;li&gt;Looping Statements (for, while) &lt;/li&gt;
&lt;li&gt;Loop Control Statements (break, continue, pass)&lt;/li&gt;
&lt;li&gt;Exception Handling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conditional statements&lt;/strong&gt;&lt;br&gt;
IF&lt;br&gt;
`age = 20&lt;/p&gt;

&lt;p&gt;if age &amp;gt;= 18:&lt;br&gt;
    print("Eligible to vote.")`&lt;/p&gt;

&lt;p&gt;ELIF and Else&lt;br&gt;
`age = 25&lt;/p&gt;

&lt;p&gt;if age &amp;lt;= 12:&lt;br&gt;
    print("Child.")&lt;br&gt;
elif age &amp;lt;= 19:&lt;br&gt;
    print("Teenager.")&lt;br&gt;
elif age &amp;lt;= 35:&lt;br&gt;
    print("Young adult.")&lt;br&gt;
else:&lt;br&gt;
    print("Adult.")`&lt;/p&gt;

&lt;p&gt;Nested IF&lt;/p&gt;

&lt;p&gt;`age = 70&lt;br&gt;
is_member = True&lt;/p&gt;

&lt;p&gt;if age &amp;gt;= 60:&lt;br&gt;
    if is_member:&lt;br&gt;
        print("30% senior discount!")&lt;br&gt;
    else:&lt;br&gt;
        print("20% senior discount.")&lt;br&gt;
else:&lt;br&gt;
    print("Not eligible for a senior discount.")`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ternary Conditional Statement in Python&lt;/strong&gt;&lt;br&gt;
A ternary conditional statement is a compact way to write an if-else condition in a single line. It’s sometimes called a "conditional expression."&lt;/p&gt;

&lt;p&gt;`# Assign a value based on a condition&lt;br&gt;
age = 20&lt;br&gt;
s = "Adult" if age &amp;gt;= 18 else "Minor"&lt;/p&gt;

&lt;p&gt;print(s)`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Match-Case Statement in Python&lt;/strong&gt;&lt;br&gt;
match-case statement is Python's version of a switch-case found in other languages. It allows us to match a variable's value against a set of patterns.&lt;/p&gt;

&lt;p&gt;`number = 2&lt;/p&gt;

&lt;p&gt;match number:&lt;br&gt;
    case 1:&lt;br&gt;
        print("One")&lt;br&gt;
    case 2 | 3:&lt;br&gt;
        print("Two or Three")&lt;br&gt;
    case _:&lt;br&gt;
        print("Other number")`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For Loop&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The for loop is used to iterate over a sequence (e.g., a list, tuple, string, or range) and execute a block of code for each item in the sequence.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;for i in range(5):&lt;br&gt;
    print(i)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;While Loop&lt;/strong&gt;&lt;br&gt;
The while loop is used to repeatedly execute a block of code as long as a specified condition is true.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;count = 0&lt;br&gt;
while count &amp;lt; 5:&lt;br&gt;
    print(count)&lt;br&gt;
    count += 1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nested Loops&lt;/strong&gt;&lt;br&gt;
Loops can be nested within one another to perform more complex iterations. For example, a for loop can be nested inside another for loop to create a two-dimensional iteration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Python For Loop with String&lt;/strong&gt;&lt;br&gt;
This code uses a for loop to iterate over a string and print each character on a new line. The loop assigns each character to the variable i and continues until all characters in the string have been processed.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;s = "Rajasekaran"&lt;br&gt;
for i in s:&lt;br&gt;
    print(i)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using range() with For Loop&lt;/strong&gt;&lt;br&gt;
The range() function is commonly used with for loops to generate a sequence of numbers. It can take one, two, or three arguments:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;range(stop)&lt;/strong&gt;: Generates numbers from 0 to stop-1.&lt;br&gt;
&lt;strong&gt;range(start, stop)&lt;/strong&gt;: Generates numbers from start to stop-1.&lt;br&gt;
&lt;strong&gt;range(start, stop, step)&lt;/strong&gt;: Generates numbers from start to stop-1, incrementing by step.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;for i in range(0, 10, 2):&lt;br&gt;
    print(i)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output&lt;/p&gt;

&lt;p&gt;&lt;code&gt;0&lt;br&gt;
2&lt;br&gt;
4&lt;br&gt;
6&lt;br&gt;
8&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  List
&lt;/h2&gt;

&lt;p&gt;a list is a built-in dynamic sized array (automatically grows and shrinks). We can store all types of items (including another list) in a list. A list may contain mixed type of items, this is possible because a list mainly stores references at contiguous locations and actual items maybe stored at different locations.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;List can contain duplicate items.&lt;/li&gt;
&lt;li&gt;List in Python are Mutable. Hence, we can modify, replace or delete the items.&lt;/li&gt;
&lt;li&gt;List are ordered. It maintain the order of elements based on how they are added.&lt;/li&gt;
&lt;li&gt;Accessing items in List can be done directly using their position (index), starting from 0&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;`# Creating a Python list with different data types&lt;br&gt;
a = [10, 20, "GfG", 40, True]&lt;br&gt;
print(a)&lt;/p&gt;
&lt;h1&gt;
  
  
  Accessing elements using indexing
&lt;/h1&gt;

&lt;p&gt;print(a[0])  # 10&lt;br&gt;
print(a[1])  # 20&lt;br&gt;
print(a[2])  # "GfG"&lt;br&gt;
print(a[3])  # 40&lt;br&gt;
print(a[4])  # True&lt;/p&gt;
&lt;h1&gt;
  
  
  Checking types of elements
&lt;/h1&gt;

&lt;p&gt;print(type(a[2]))  # str&lt;br&gt;
print(type(a[4]))  # bool`&lt;/p&gt;

&lt;p&gt;Create List:&lt;br&gt;
`# List of integers&lt;br&gt;
a = [1, 2, 3, 4, 5]&lt;/p&gt;
&lt;h1&gt;
  
  
  List of strings
&lt;/h1&gt;

&lt;p&gt;b = ['apple', 'banana', 'cherry']&lt;/p&gt;
&lt;h1&gt;
  
  
  Mixed data types
&lt;/h1&gt;

&lt;p&gt;c = [1, 'hello', 3.14, True]&lt;/p&gt;

&lt;p&gt;print(a)&lt;br&gt;
print(b)&lt;br&gt;
print(c)`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adding Elements into List&lt;/strong&gt;&lt;br&gt;
We can add elements to a list using the following methods:&lt;/p&gt;

&lt;p&gt;append(): Adds an element at the end of the list.&lt;br&gt;
extend(): Adds multiple elements to the end of the list.&lt;br&gt;
insert(): Adds an element at a specific position.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Initialize an empty list
a = []

# Adding 10 to end of list
a.append(10)  
print("After append(10):", a)  

# Inserting 5 at index 0
a.insert(0, 5)
print("After insert(0, 5):", a) 

# Adding multiple elements  [15, 20, 25] at the end
a.extend([15, 20, 25])  
print("After extend([15, 20, 25]):", a)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Updating Elements into List&lt;/strong&gt;&lt;br&gt;
We can change the value of an element by accessing it using its index.&lt;/p&gt;

&lt;p&gt;`a = [10, 20, 30, 40, 50]&lt;/p&gt;
&lt;h1&gt;
  
  
  Change the second element
&lt;/h1&gt;

&lt;p&gt;a[1] = 25 &lt;br&gt;
print(a)`&lt;/p&gt;

&lt;p&gt;Removing Elements from List&lt;br&gt;
We can remove elements from a list using:&lt;/p&gt;

&lt;p&gt;remove(): Removes the first occurrence of an element.&lt;br&gt;
pop(): Removes the element at a specific index or the last element if no index is specified.&lt;br&gt;
del statement: Deletes an element at a specified index.&lt;/p&gt;

&lt;p&gt;`a = [10, 20, 30, 40, 50]&lt;/p&gt;
&lt;h1&gt;
  
  
  Removes the first occurrence of 30
&lt;/h1&gt;

&lt;p&gt;a.remove(30)&lt;br&gt;&lt;br&gt;
print("After remove(30):", a)&lt;/p&gt;
&lt;h1&gt;
  
  
  Removes the element at index 1 (20)
&lt;/h1&gt;

&lt;p&gt;popped_val = a.pop(1)&lt;br&gt;&lt;br&gt;
print("Popped element:", popped_val)&lt;br&gt;
print("After pop(1):", a) &lt;/p&gt;
&lt;h1&gt;
  
  
  Deletes the first element (10)
&lt;/h1&gt;

&lt;p&gt;del a[0]&lt;br&gt;&lt;br&gt;
print("After del a[0]:", a)`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Iterating Over Lists&lt;/strong&gt;&lt;br&gt;
We can iterate the Lists easily by using a for loop or other iteration methods. Iterating over lists is useful when we want to do some operation on each item or access specific items based on certain conditions. Let's take an example to iterate over the list using for loop.&lt;/p&gt;

&lt;p&gt;`a = ['apple', 'banana', 'cherry']&lt;/p&gt;
&lt;h1&gt;
  
  
  Iterating over the list
&lt;/h1&gt;

&lt;p&gt;for item in a:&lt;br&gt;
    print(item)`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nested Lists in Python&lt;/strong&gt;&lt;br&gt;
A nested list is a list within another list, which is useful for representing matrices or tables. We can access nested elements by chaining indexes.&lt;/p&gt;

&lt;p&gt;`matrix = [&lt;br&gt;
    [1, 2, 3],&lt;br&gt;
    [4, 5, 6],&lt;br&gt;
    [7, 8, 9]&lt;br&gt;
]&lt;/p&gt;
&lt;h1&gt;
  
  
  Access element at row 2, column 3
&lt;/h1&gt;

&lt;p&gt;print(matrix[1][2])`&lt;/p&gt;

&lt;p&gt;output&lt;/p&gt;

&lt;p&gt;&lt;code&gt;6&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;List Slicing&lt;/strong&gt;&lt;br&gt;
Python list slicing is fundamental concept that let us easily access specific elements in a list&lt;/p&gt;

&lt;p&gt;`a = [1, 2, 3, 4, 5, 6, 7, 8, 9]&lt;/p&gt;
&lt;h1&gt;
  
  
  Get elements from index 1 to 4 (excluded)
&lt;/h1&gt;

&lt;p&gt;print(a[1:4])`&lt;/p&gt;

&lt;p&gt;output&lt;/p&gt;

&lt;p&gt;&lt;code&gt;[2, 3, 4]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Python List Slicing Syntax&lt;/strong&gt;&lt;br&gt;
list_name[start : end : step]&lt;/p&gt;

&lt;p&gt;Parameters:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;start&lt;/strong&gt; (optional): Index to begin the slice (inclusive). Defaults to 0 if omitted.&lt;br&gt;
&lt;strong&gt;end&lt;/strong&gt; (optional): Index to end the slice (exclusive). Defaults to the length of list if omitted.&lt;br&gt;
&lt;strong&gt;step&lt;/strong&gt; (optional): Step size, specifying the interval between elements. Defaults to 1 if omitted&lt;/p&gt;

&lt;p&gt;`a = [1, 2, 3, 4, 5, 6, 7, 8, 9]&lt;/p&gt;
&lt;h1&gt;
  
  
  Get all elements in the list
&lt;/h1&gt;

&lt;p&gt;print(a[::])&lt;br&gt;
print(a[:])`&lt;/p&gt;
&lt;h2&gt;
  
  
  Dictionaries
&lt;/h2&gt;

&lt;p&gt;Python dictionary is a data structure that stores the value in key: value pairs. Values in a dictionary can be of any data type and can be duplicated, whereas keys can't be repeated and must be immutable.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;d = {1: 'Raj', 2: 'Ram', 3: 'Rani'}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adding and Updating Dictionary Items&lt;/strong&gt;&lt;br&gt;
We can add new key-value pairs or update existing keys by using assignment.&lt;/p&gt;

&lt;p&gt;`d = {1: 'Raj', 2: 'Ram', 3: 'Rani'}&lt;/p&gt;
&lt;h1&gt;
  
  
  Adding a new key-value pair
&lt;/h1&gt;

&lt;p&gt;d["age"] = 32&lt;/p&gt;
&lt;h1&gt;
  
  
  Updating an existing value
&lt;/h1&gt;

&lt;p&gt;d[1] = "Sekar"&lt;/p&gt;

&lt;p&gt;print(d)`&lt;/p&gt;

&lt;p&gt;Output&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{1: 'Sekar', 2: 'Ram', 3: 'Rani', 'age': 32}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Removing Dictionary Items&lt;/strong&gt;&lt;br&gt;
We can remove items from dictionary using the following methods:&lt;/p&gt;

&lt;p&gt;del: Removes an item by key.&lt;br&gt;
pop(): Removes an item by key and returns its value.&lt;br&gt;
clear(): Empties the dictionary.&lt;br&gt;
popitem(): Removes and returns the last key-value pair.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;d = {1: 'Raj', 2: 'Ram', 3: 'Sekar', 'age':22}

# Using del to remove an item
del d["age"]
print(d)

# Using pop() to remove an item and return the value
val = d.pop(1)
print(val)

# Using popitem to removes and returns
# the last key-value pair.
key, val = d.popitem()
print(f"Key: {key}, Value: {val}")

# Clear all items from the dictionary
d.clear()
print(d)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nested Dictionaries&lt;/p&gt;

&lt;p&gt;Example of Nested Dictionary:&lt;/p&gt;

&lt;p&gt;Nested Dictionaries&lt;/p&gt;

&lt;p&gt;d = {1: 'Raj', 2: 'Sekaran',&lt;br&gt;
        3: {'A': '1', 'B': 'To', 'C': '3'}}&lt;br&gt;
​&lt;br&gt;
print(d)Nested Dictionaries&lt;br&gt;
​&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Data Analytics Week 1 Notes</title>
      <dc:creator>Rajasekaran Palraj</dc:creator>
      <pubDate>Wed, 06 Aug 2025 14:40:28 +0000</pubDate>
      <link>https://dev.to/raja_sekaran_a1319259e6f1/data-analytics-week-1-notes-3d91</link>
      <guid>https://dev.to/raja_sekaran_a1319259e6f1/data-analytics-week-1-notes-3d91</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Data Analytics&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;It is a process of examining, cleaning, transforming and interpreting data to discover useful information, draw conclusions and support decision-making. It helps businesses and organizations understand their data better, identify patterns, solve problems and improve overall performance.&lt;/p&gt;

&lt;p&gt;**&lt;br&gt;
How data analytics works:**&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Define Objectives&lt;/li&gt;
&lt;li&gt;Data Collection &lt;/li&gt;
&lt;li&gt;Data Cleaning &amp;amp; Data Processing&lt;/li&gt;
&lt;li&gt;Analysis Techniques&lt;/li&gt;
&lt;li&gt;Interpretation of Results &lt;/li&gt;
&lt;li&gt;Visualization and Communication&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Technical Skill for Data Analytics&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SQL&lt;/li&gt;
&lt;li&gt;Statistics&lt;/li&gt;
&lt;li&gt;Excel&lt;/li&gt;
&lt;li&gt;Data Visualization&lt;/li&gt;
&lt;li&gt;Programming Languages&lt;/li&gt;
&lt;li&gt;Mathematics&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Data
&lt;/h2&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**What is data?**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Data is distinct pieces of information, usually formatted in a special way&lt;/p&gt;

&lt;p&gt;**&lt;br&gt;
Data can be generated by:**&lt;br&gt;
Humans&lt;br&gt;
Machines&lt;br&gt;
Human-Machine combines.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why data is so important?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data helps in making better decisions.&lt;/li&gt;
&lt;li&gt;Data helps in solving problems by finding the reason for underperformance.&lt;/li&gt;
&lt;li&gt;Data helps one to evaluate performance.&lt;/li&gt;
&lt;li&gt;Data helps one improve processes.&lt;/li&gt;
&lt;li&gt;Data helps one understand consumers and the market.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Categories of Data&lt;/strong&gt;&lt;br&gt;
Data can be categorized into two main parts -&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Structured data&lt;/li&gt;
&lt;li&gt;Unstructured data&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Excel
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Ribbon&lt;/strong&gt;: The toolbar at the top of Excel which is divided into tabs that group related tools and commands.&lt;br&gt;
Formula Bar: Displays the contents or formulas of the active cell and allows editing.&lt;br&gt;
&lt;strong&gt;Worksheet Area&lt;/strong&gt;: The grid where we enter and manipulate our data and it is made up of rows and columns.&lt;br&gt;
Navigation Tools: It includes sheet tabs at the bottom, scroll bars and zoom controls for easy movement within our workbook&lt;br&gt;
All Tabs in Excel Ribbon&lt;br&gt;
Ribbon is divided into several tabs and each serving different purposes:&lt;br&gt;
&lt;strong&gt;Home Tab:&lt;/strong&gt; The most commonly used tab for everyday tasks. It includes formatting options (font, alignment, colors), number formatting, table styles, cell editing and basic tools like AutoSum and Sort &amp;amp; Filter.&lt;br&gt;
&lt;strong&gt;Insert Tab&lt;/strong&gt;: Lets us add tables, charts, images, shapes, hyperlinks, text boxes, symbols and sparklines to make our worksheet more visual and interactive.&lt;br&gt;
Page Layout Tab: Controls how our worksheet looks when printed. Adjust themes, margins, page orientation, size, print area and background here.&lt;br&gt;
&lt;strong&gt;Formulas Tab:&lt;/strong&gt; The central place to create and manage formulas it includes the Function Library for logical, text, date, math and financial functions, plus named ranges and formula auditing tools.&lt;br&gt;
&lt;strong&gt;Data Tab&lt;/strong&gt;: Helps us import, organize and analyze data. Key features include Get &amp;amp; Transform (Power Query), Sort &amp;amp; Filter, Data Validation, Flash Fill, Text to Columns and Forecast tools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Formulas&lt;/strong&gt;:&lt;br&gt;
=SUM(Arg1: Arg2): It is used to find the sum of all the numeric data specified in the given range of numbers.&lt;br&gt;
=COUNT(Arg1: Arg2):  It is used to count all the number of cells(it will count only number) specified in the given range of numbers.&lt;br&gt;
=MAX(Arg1: Arg2): It is used to find the maximum number from the given range of numbers.&lt;br&gt;
=MIN(Arg1: Arg2): It is used to find the minimum number from the given range of numbers.&lt;br&gt;
=TODAY(): It is used to find today's date.&lt;br&gt;
=SQRT(Arg1): It is used to find the square root of the specified cell.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Workbook?&lt;/strong&gt;&lt;br&gt;
A collection of worksheets is referred to as a workbook (spreadsheets). Workbooks are your Excel files. You'll need to create a new workbook every time you start a new project in Excel. There are various ways to begin working with an Excel workbook. You can either start from scratch or use a pre-designed template to create a new workbook or access an existing one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Characteristics of a good worksheet&lt;/strong&gt;&lt;br&gt;
An appealing worksheet should have specific titles that indicate what it is about as well as pictures or other clipart to draw some attention.&lt;br&gt;
It is important that the paper and the writing are in good contrast so that eye strain is minimized.&lt;br&gt;
Users should be able to do the worksheet independently by following the directions with examples.&lt;br&gt;
Despite the fact that the worksheet needs to illuminate a pattern in problem solving or usage, it shouldn't grind an idea into dust.&lt;br&gt;
Once the worksheet has been completed, the user should be able to explain how it was formed or what it was meant to teach: the answer to this question should be linked to the worksheet's title.&lt;/p&gt;

&lt;p&gt;Important functions&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create table (Home &amp;gt; Style &amp;gt; Format Table)&lt;/li&gt;
&lt;li&gt;Count Nulls  (select columns then =COUNTBLANK())&lt;/li&gt;
&lt;li&gt;sorting( Select Data &amp;gt; Data Tab&amp;gt; Sort)&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Filter&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data between Filter&lt;/li&gt;
&lt;li&gt;Number greater than or equals filter&lt;/li&gt;
&lt;li&gt;Clear Filter&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Total Row function&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Conditional Formatting&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select Range&lt;/li&gt;
&lt;li&gt;Choose Formatting&lt;/li&gt;
&lt;li&gt;Data Bars&lt;/li&gt;
&lt;li&gt;Color Scales&lt;/li&gt;
&lt;li&gt;Manage Rule&lt;/li&gt;
&lt;li&gt;Top/Bottom Rules&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;If Function&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;SumIf/SumIfs&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Range&lt;/li&gt;
&lt;li&gt;Criteria&lt;/li&gt;
&lt;li&gt;Sum Range&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;AvergeIf/AverageIfs&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Chart Types
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Understanding Your Data and Visualization Goals&lt;/strong&gt;&lt;br&gt;
Before choosing the right chart it's essential to understand the nature of your data and the message you want to convey. To understand consider the following questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is the primary purpose of the visualization?&lt;/li&gt;
&lt;li&gt;What type of data are you working with?&lt;/li&gt;
&lt;li&gt;How many variables are you visualizing?&lt;/li&gt;
&lt;li&gt;What is the volume of data points?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1. Comparison Charts&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bar Chart: Compares categories using horizontal bars (e.g., product sales).&lt;/li&gt;
&lt;li&gt;Column Chart: Uses vertical bars, great for time-based or hierarchical data.&lt;/li&gt;
&lt;li&gt;Radar Chart: Displays multiple variables in a circular layout, ideal for comparing performance across categories&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Trend Charts&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Line Chart: Shows trends over time with connected points (e.g., monthly sales).&lt;/li&gt;
&lt;li&gt;Area Chart: Like a line chart but fills the space below, showing cumulative totals.&lt;/li&gt;
&lt;li&gt;Waterfall Chart: Displays how increases and decreases affect a total (e.g., profit changes).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Relationship Charts&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scatter Chart: Plots two variables to show their relationship or trend.&lt;/li&gt;
&lt;li&gt;Bubble Chart: Adds size and color to scatter plots for more variable comparison.&lt;/li&gt;
&lt;li&gt;Heatmap: Uses color in grids to reveal patterns, density or relationships in data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Distribution Charts&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Histogram: Shows frequency of values within ranges.&lt;/li&gt;
&lt;li&gt;Box Plot: Displays data spread, median and outliers.&lt;/li&gt;
&lt;li&gt;KDE Plot: Smooth curve showing data distribution shape.&lt;/li&gt;
&lt;li&gt;Violin Plot: Combines box plot and density curve to compare group distributions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Composition Charts&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pie Chart: Best for small datasets shows each part’s share of the total.&lt;/li&gt;
&lt;li&gt;Stacked Bar Chart: Compares parts across categories within bars.&lt;/li&gt;
&lt;li&gt;Treemap: Uses nested boxes sized by value to show part-to-whole relationships.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6. Geographical Charts&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choropleth Map: Uses color to show values (like population or income) across regions.&lt;/li&gt;
&lt;li&gt;Cartogram: Resizes regions based on data values (e.g., population) distorting geography for emphasis.ed&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Handle Null in Elasticsearch Aggrgation</title>
      <dc:creator>Rajasekaran Palraj</dc:creator>
      <pubDate>Tue, 05 Aug 2025 07:16:06 +0000</pubDate>
      <link>https://dev.to/raja_sekaran_a1319259e6f1/handle-null-in-elasticsearch-aggrgation-2823</link>
      <guid>https://dev.to/raja_sekaran_a1319259e6f1/handle-null-in-elasticsearch-aggrgation-2823</guid>
      <description>&lt;p&gt;Sample Data&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{"system": "aaa","ip":"0.0.0.1"},&lt;br&gt;
{"system": "bbb","ip":"0.0.0.2"},&lt;br&gt;
{"system": null,"ip":"0.0.0.3"},&lt;br&gt;
{"ip":"0.0.0.4"}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Basic aggregation query&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
    "aggs" : {&lt;br&gt;
        "myAggrs" : {&lt;br&gt;
            "terms" : { "field" : "system" }&lt;br&gt;
        } &lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output for above:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
   "key": "aaa",&lt;br&gt;
   "doc_count": 1&lt;br&gt;
},&lt;br&gt;
{&lt;br&gt;
   "key": "bbb",&lt;br&gt;
   "doc_count": 1&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It ignores whether the field is null or if it's missing&lt;/p&gt;

&lt;p&gt;The expected result is&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
   "key": "aaa",&lt;br&gt;
   "doc_count": 1&lt;br&gt;
},&lt;br&gt;
{&lt;br&gt;
   "key": "bbb",&lt;br&gt;
   "doc_count": 1&lt;br&gt;
},&lt;br&gt;
{&lt;br&gt;
   "key": null,&lt;br&gt;
   "doc_count": 2&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To solve this, we have to change the query like this,&lt;br&gt;
&lt;code&gt;{&lt;br&gt;
    "aggs" : {&lt;br&gt;
        "myAggrs" : {&lt;br&gt;
            "terms" : { "field" : "system" },&lt;br&gt;
            "missing" : "NULL"&lt;br&gt;
        } &lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We will get below &lt;br&gt;
&lt;code&gt;{&lt;br&gt;
   "key": "aaa",&lt;br&gt;
   "doc_count": 1&lt;br&gt;
},&lt;br&gt;
{&lt;br&gt;
   "key": "bbb",&lt;br&gt;
   "doc_count": 1&lt;br&gt;
},&lt;br&gt;
{&lt;br&gt;
   "key": "NULL",&lt;br&gt;
   "doc_count": 2&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
