<?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: Enock Kiprotich</title>
    <description>The latest articles on DEV Community by Enock Kiprotich (@enockdata).</description>
    <link>https://dev.to/enockdata</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%2F3818269%2F88a9bafa-b699-45f6-b4c9-f8867f049f4f.png</url>
      <title>DEV Community: Enock Kiprotich</title>
      <link>https://dev.to/enockdata</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/enockdata"/>
    <language>en</language>
    <item>
      <title>Introduction to Python</title>
      <dc:creator>Enock Kiprotich</dc:creator>
      <pubDate>Sun, 10 May 2026 09:17:39 +0000</pubDate>
      <link>https://dev.to/enockdata/introduction-to-python-48f7</link>
      <guid>https://dev.to/enockdata/introduction-to-python-48f7</guid>
      <description>&lt;h2&gt;
  
  
  Python for Data Analytics: From Beginner Basics to Real-World Data Projects
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;A beginner-friendly guide to understanding Python, data analytics, APIs, JSON data, and working with real-world datasets using Python.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Over the past decade, Python has become one of the most important programming languages in the world. From web development and artificial intelligence to cybersecurity and automation, Python continues to dominate many areas of technology. However, one area where Python has had a particularly massive impact is &lt;strong&gt;data analytics&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Today, businesses, governments, healthcare institutions, banks, researchers, and social media companies all depend on data to make decisions. Because of this, organizations need professionals who can collect, clean, analyze, and visualize data effectively. Python has become the preferred tool for performing these tasks because it is simple, powerful, and highly flexible.&lt;/p&gt;

&lt;p&gt;For beginners entering the tech industry, Python is often recommended as the first programming language to learn. Its readable syntax, large community, and huge collection of libraries make it easier for learners to transition into data analytics and data science.&lt;/p&gt;

&lt;p&gt;This article explains what Python is, why it is popular in data analytics, the libraries used in analytics, how Python handles data, and why beginners should consider learning it.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Python?
&lt;/h2&gt;

&lt;p&gt;Python is a high-level programming language created by &lt;strong&gt;Guido van Rossum&lt;/strong&gt; and first released in 1991. It was designed to emphasize readability and simplicity, allowing programmers to write code that is easy to understand.&lt;/p&gt;

&lt;p&gt;Unlike low-level programming languages that can be difficult to read, Python uses simple English-like syntax. This makes it beginner-friendly and suitable for people who are new to programming.&lt;/p&gt;

&lt;p&gt;For example, displaying text in Python is very simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello World&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because of its simplicity, Python is widely used in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data analytics&lt;/li&gt;
&lt;li&gt;Artificial intelligence&lt;/li&gt;
&lt;li&gt;Machine learning&lt;/li&gt;
&lt;li&gt;Web development&lt;/li&gt;
&lt;li&gt;Cybersecurity&lt;/li&gt;
&lt;li&gt;Automation&lt;/li&gt;
&lt;li&gt;Scientific computing&lt;/li&gt;
&lt;li&gt;Software development&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Python is also open-source, meaning anyone can use it for free.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Python is Popular in Data Analytics
&lt;/h2&gt;

&lt;p&gt;Python has become extremely popular in the data analytics industry for several reasons.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Easy to Learn
&lt;/h3&gt;

&lt;p&gt;Python is considered one of the easiest programming languages for beginners. Its syntax is simple and resembles normal English.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Adult&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because data analytics already involves statistics, business understanding, and critical thinking, using a simple programming language helps learners focus on analytics instead of struggling with complex code.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Large Collection of Libraries
&lt;/h3&gt;

&lt;p&gt;Python has powerful libraries specifically designed for data analysis and visualization.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Library&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pandas&lt;/td&gt;
&lt;td&gt;Data cleaning and analysis&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NumPy&lt;/td&gt;
&lt;td&gt;Numerical computations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Matplotlib&lt;/td&gt;
&lt;td&gt;Data visualization&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Seaborn&lt;/td&gt;
&lt;td&gt;Advanced visualization&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scikit-learn&lt;/td&gt;
&lt;td&gt;Machine learning&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Requests&lt;/td&gt;
&lt;td&gt;Working with APIs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  3. Strong Community Support
&lt;/h3&gt;

&lt;p&gt;Python has one of the largest developer communities in the world. If a learner faces a challenge, there are thousands of tutorials, forums, YouTube videos, and articles available online.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. Integration with Other Technologies
&lt;/h3&gt;

&lt;p&gt;Python works well with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SQL databases&lt;/li&gt;
&lt;li&gt;APIs&lt;/li&gt;
&lt;li&gt;Excel&lt;/li&gt;
&lt;li&gt;Power BI&lt;/li&gt;
&lt;li&gt;Tableau&lt;/li&gt;
&lt;li&gt;Cloud platforms&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This flexibility makes Python useful in real-world analytics environments.&lt;/p&gt;




&lt;h2&gt;
  
  
  Python Libraries Used in Data Analytics
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Pandas
&lt;/h3&gt;

&lt;p&gt;Pandas is one of the most important Python libraries for data analytics.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sales.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;head&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pandas uses a structure called a &lt;strong&gt;DataFrame&lt;/strong&gt;, which looks similar to an Excel table.&lt;/p&gt;




&lt;h3&gt;
  
  
  NumPy
&lt;/h3&gt;

&lt;p&gt;NumPy is used for numerical computations and mathematical operations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;

&lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Matplotlib
&lt;/h3&gt;

&lt;p&gt;Matplotlib helps analysts create charts and graphs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;

&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;plot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Requests
&lt;/h3&gt;

&lt;p&gt;The Requests library is used to interact with APIs and web services.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://dummyjson.com/products&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How Python is Used in Data Analytics
&lt;/h2&gt;

&lt;p&gt;Python plays a major role in the data analytics workflow.&lt;/p&gt;

&lt;p&gt;The major stages include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Data collection&lt;/li&gt;
&lt;li&gt;Data cleaning&lt;/li&gt;
&lt;li&gt;Data analysis&lt;/li&gt;
&lt;li&gt;Data visualization&lt;/li&gt;
&lt;li&gt;Reporting&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Data Collection
&lt;/h2&gt;

&lt;p&gt;Python helps analysts collect data from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CSV files&lt;/li&gt;
&lt;li&gt;APIs&lt;/li&gt;
&lt;li&gt;Excel files&lt;/li&gt;
&lt;li&gt;JSON files&lt;/li&gt;
&lt;li&gt;Databases&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;employees.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Data Cleaning
&lt;/h2&gt;

&lt;p&gt;Raw data is usually messy. It may contain:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Missing values&lt;/li&gt;
&lt;li&gt;Duplicates&lt;/li&gt;
&lt;li&gt;Errors&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Python helps clean data efficiently.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;drop_duplicates&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inplace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fillna&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;inplace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Data Analysis
&lt;/h2&gt;

&lt;p&gt;Python helps identify patterns and insights.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;sales&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;revenue&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Grouping data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;grouped&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;groupby&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;department&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;revenue&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;grouped&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Data Visualization
&lt;/h2&gt;

&lt;p&gt;Visualization helps businesses understand data better.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;

&lt;span class="n"&gt;departments&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;HR&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;IT&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Finance&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;revenue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;departments&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;revenue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Revenue by Department&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Real-World Applications of Python
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Healthcare
&lt;/h3&gt;

&lt;p&gt;Hospitals use Python to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Analyze patient records&lt;/li&gt;
&lt;li&gt;Predict diseases&lt;/li&gt;
&lt;li&gt;Monitor hospital performance&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Banking and Finance
&lt;/h3&gt;

&lt;p&gt;Banks use Python for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fraud detection&lt;/li&gt;
&lt;li&gt;Credit scoring&lt;/li&gt;
&lt;li&gt;Risk analysis&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  E-commerce
&lt;/h3&gt;

&lt;p&gt;Online stores use Python to analyze:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customer behavior&lt;/li&gt;
&lt;li&gt;Product sales&lt;/li&gt;
&lt;li&gt;Market trends&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why Beginners Should Learn Python
&lt;/h2&gt;

&lt;h3&gt;
  
  
  High Demand in the Job Market
&lt;/h3&gt;

&lt;p&gt;Many companies are looking for professionals with Python skills.&lt;/p&gt;

&lt;p&gt;Common roles include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data Analyst&lt;/li&gt;
&lt;li&gt;Data Scientist&lt;/li&gt;
&lt;li&gt;Business Analyst&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Beginner-Friendly
&lt;/h3&gt;

&lt;p&gt;Python is easier to read and understand than many other programming languages.&lt;/p&gt;




&lt;h3&gt;
  
  
  Strong Salary Potential
&lt;/h3&gt;

&lt;p&gt;Professionals with Python and analytics skills often earn competitive salaries globally.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 2: Working with JSON Data from GitHub
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Step 1: Import Required Libraries
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 2: Define the Raw GitHub URL
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://raw.githubusercontent.com/yourusername/repository/main/data.json&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 3: Send Request to GitHub
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 4: Extract JSON Data
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 5: Convert JSON to DataFrame
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 6: Save as CSV File
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;synthetic_data.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Complete Python Script
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://raw.githubusercontent.com/yourusername/repository/main/data.json&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;head&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;synthetic_data.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CSV file saved successfully&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Part 3: Working with DummyJSON API Endpoints
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Products Endpoint
&lt;/h2&gt;

&lt;p&gt;API URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;dummyjson&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;products&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Python Code for Products Endpoint
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://dummyjson.com/products&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;products&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;products&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;head&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;products.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Products CSV saved successfully&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Carts Endpoint
&lt;/h2&gt;

&lt;p&gt;API URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;dummyjson&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;carts&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Python Code for Carts Endpoint
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://dummyjson.com/carts&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;carts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;carts&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;carts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;head&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;carts.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Carts CSV saved successfully&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Importance of APIs in Data Analytics
&lt;/h2&gt;

&lt;p&gt;APIs allow analysts to collect real-time data from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Websites&lt;/li&gt;
&lt;li&gt;Financial systems&lt;/li&gt;
&lt;li&gt;Weather services&lt;/li&gt;
&lt;li&gt;Social media platforms&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Modern analytics heavily depends on API integrations.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Python has become one of the most important tools in the data analytics industry. Its simplicity, flexibility, and powerful libraries make it ideal for beginners and professionals alike.&lt;/p&gt;

&lt;p&gt;With Python, analysts can collect, clean, analyze, visualize, and automate data-related tasks efficiently. Organizations across healthcare, finance, e-commerce, social media, and government continue to rely on Python for decision-making and business intelligence.&lt;/p&gt;

&lt;p&gt;Additionally, understanding APIs, JSON data, GitHub raw files, and CSV processing gives learners practical experience in handling real-world data workflows.&lt;/p&gt;

&lt;p&gt;As technology continues to evolve, Python will remain one of the leading tools for data analytics, machine learning, and artificial intelligence.&lt;/p&gt;




</description>
      <category>dataanalytics</category>
      <category>python</category>
      <category>datascience</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Subqueries vs CTEs in SQL: A Practical Guide for Data Analysts</title>
      <dc:creator>Enock Kiprotich</dc:creator>
      <pubDate>Wed, 22 Apr 2026 05:55:03 +0000</pubDate>
      <link>https://dev.to/enockdata/subqueries-vs-ctes-in-sql-a-practical-guide-for-data-analysts-1beg</link>
      <guid>https://dev.to/enockdata/subqueries-vs-ctes-in-sql-a-practical-guide-for-data-analysts-1beg</guid>
      <description>&lt;h2&gt;
  
  
  💡 How I Finally Understood Subqueries vs CTEs
&lt;/h2&gt;

&lt;p&gt;When I first started learning SQL, I remember feeling confident—until I ran into subqueries.&lt;/p&gt;

&lt;p&gt;At first, they seemed simple. “Just a query inside another query,” I told myself. But the moment I started working with more complex datasets, my queries became harder to read, harder to debug, and honestly… frustrating.&lt;/p&gt;

&lt;p&gt;Then I discovered CTEs.&lt;/p&gt;

&lt;p&gt;I still remember rewriting one of my messy nested queries using a CTE—and suddenly, everything made sense. The logic was clearer, the structure felt natural, and debugging became much easier. That was the moment I realized something important:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Writing SQL isn’t just about getting the right answer—it’s about writing queries that &lt;em&gt;make sense&lt;/em&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Since then, I’ve learned that both subqueries and CTEs are powerful tools—but they serve different purposes. Knowing when to use each is what separates beginner SQL users from confident data analysts.&lt;/p&gt;

&lt;p&gt;In this article, I’ll break down both concepts in a simple, practical way—based on what actually works in real-world data analysis.&lt;/p&gt;

&lt;p&gt;When working with SQL, you’ll eventually run into situations where a single query isn’t enough. You need to break down logic, reuse results, or simplify complex operations.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔍 Understanding Subqueries (The “Quick Solution” Tool)
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;subquery&lt;/strong&gt; is simply a query inside another query. Think of it as asking SQL to first answer a smaller question before solving the main one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;customer_name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;customer_id&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;customer_id&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
    &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;total_amount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, SQL first finds customers with large orders, then uses that result to filter the main query.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔹 Types of Subqueries You’ll Encounter
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Single-Value Subqueries
&lt;/h3&gt;

&lt;p&gt;Used when you expect one result (e.g., averages).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  2. Multi-Value Subqueries
&lt;/h3&gt;

&lt;p&gt;Return multiple results and are often used with &lt;code&gt;IN&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Products&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;product_id&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;product_id&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Sales&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  3. Correlated Subqueries
&lt;/h3&gt;

&lt;p&gt;These are more dynamic—they run once for every row in the outer query.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;
    &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👉 Powerful, but can be slow if not used carefully.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎯 When Subqueries Make Sense
&lt;/h2&gt;

&lt;p&gt;Subqueries are best when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need a quick filter&lt;/li&gt;
&lt;li&gt;The logic is simple&lt;/li&gt;
&lt;li&gt;You don’t need to reuse the result&lt;/li&gt;
&lt;li&gt;You’re working with aggregates like AVG or SUM&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They’re great for &lt;strong&gt;straightforward problems&lt;/strong&gt;, but can get messy fast.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 CTEs: A More Structured Approach
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;CTE (Common Table Expression)&lt;/strong&gt; is like giving a name to a temporary result so you can use it in your query.&lt;/p&gt;

&lt;p&gt;It’s defined using the &lt;code&gt;WITH&lt;/code&gt; keyword.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;HighValueCustomers&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total_amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;total_spent&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
    &lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;customer_id&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;HighValueCustomers&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;total_spent&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of nesting queries, you separate the logic into steps—which makes everything easier to read.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔹 Types of CTEs
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Simple CTE
&lt;/h3&gt;

&lt;p&gt;Used to simplify complex queries into readable steps.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Recursive CTE
&lt;/h3&gt;

&lt;p&gt;Useful for hierarchical data like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Organizational structures&lt;/li&gt;
&lt;li&gt;Category trees&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  3. Multi-CTE Queries
&lt;/h3&gt;

&lt;p&gt;You can define multiple CTEs and combine them—very useful in real projects.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚖️ Subqueries vs CTEs: What Really Matters
&lt;/h2&gt;

&lt;p&gt;Let’s go beyond definitions and look at what actually matters in practice:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Subqueries&lt;/th&gt;
&lt;th&gt;CTEs&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Readability&lt;/td&gt;
&lt;td&gt;Can become confusing quickly&lt;/td&gt;
&lt;td&gt;Much easier to follow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reusability&lt;/td&gt;
&lt;td&gt;One-time use&lt;/td&gt;
&lt;td&gt;Reusable within the query&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Debugging&lt;/td&gt;
&lt;td&gt;Harder to isolate issues&lt;/td&gt;
&lt;td&gt;Easier to test step-by-step&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Performance&lt;/td&gt;
&lt;td&gt;Can be inefficient (especially correlated ones)&lt;/td&gt;
&lt;td&gt;Often optimized better&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best Use&lt;/td&gt;
&lt;td&gt;Simple filtering&lt;/td&gt;
&lt;td&gt;Complex logic&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🚀 Choosing the Right Approach
&lt;/h2&gt;

&lt;p&gt;Here’s a simple way to think about it:&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Subqueries if:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The query is small and simple&lt;/li&gt;
&lt;li&gt;You only need the result once&lt;/li&gt;
&lt;li&gt;You’re filtering data&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Use CTEs if:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The query is getting hard to read&lt;/li&gt;
&lt;li&gt;You want to break logic into steps&lt;/li&gt;
&lt;li&gt;You need to reuse results&lt;/li&gt;
&lt;li&gt;You’re working on real-world data analysis&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  📊 Real-World Perspective
&lt;/h2&gt;

&lt;p&gt;In real projects (especially dashboards or reporting):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Subqueries are often used for &lt;strong&gt;quick checks&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;CTEs are used to &lt;strong&gt;structure complex transformations&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're building something that others will read or maintain, CTEs are usually the better choice.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧾 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Subqueries and CTEs solve similar problems—but they do it in different ways.&lt;/p&gt;

&lt;p&gt;Subqueries are quick and compact.&lt;br&gt;
CTEs are structured and scalable.&lt;/p&gt;

&lt;p&gt;The real skill isn’t just knowing them—it’s knowing &lt;strong&gt;when to use each&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  📌 Key Takeaway
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;If your query is becoming hard to read, that’s your signal to switch to a CTE.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;✍️ Enock Kiprotich&lt;br&gt;&lt;br&gt;
Aspiring Data Analyst | SQL | Power BI | Python&lt;br&gt;&lt;br&gt;
📍 Open to Data Analyst Roles&lt;br&gt;&lt;br&gt;
🔗 linkedin.com/in/enock-kiprotich-30382a189&lt;/p&gt;

</description>
      <category>sql</category>
      <category>datascience</category>
      <category>businessintelligence</category>
      <category>dataanalytics</category>
    </item>
    <item>
      <title>Understanding Data Modeling in Power BI: Joins, Relationships, and Schemas Explained</title>
      <dc:creator>Enock Kiprotich</dc:creator>
      <pubDate>Sun, 29 Mar 2026 13:46:56 +0000</pubDate>
      <link>https://dev.to/enockdata/-understanding-data-modeling-in-power-bi-joins-relationships-and-schemas-explained-3944</link>
      <guid>https://dev.to/enockdata/-understanding-data-modeling-in-power-bi-joins-relationships-and-schemas-explained-3944</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Data modeling is a key step when working with Power BI. Before creating dashboards, data must be structured in a clear and logical way. A good data model improves performance, reduces errors, and makes analysis easier.&lt;/p&gt;

&lt;p&gt;This article explains data modeling, SQL joins, Power BI relationships, schemas, and how to create them step-by-step.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Data Modeling?
&lt;/h2&gt;

&lt;p&gt;Data modeling is the process of organizing data into tables and defining how those tables are connected.&lt;/p&gt;

&lt;p&gt;It involves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Structuring tables
&lt;/li&gt;
&lt;li&gt;Defining keys
&lt;/li&gt;
&lt;li&gt;Creating relationships
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why it matters
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Faster reports
&lt;/li&gt;
&lt;li&gt;Accurate calculations
&lt;/li&gt;
&lt;li&gt;Better organization
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  SQL Joins (With Diagrams)
&lt;/h2&gt;

&lt;p&gt;Assume two tables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customers (ID, Name)
&lt;/li&gt;
&lt;li&gt;Orders (ID, CustomerID)
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  1. INNER JOIN
&lt;/h3&gt;

&lt;p&gt;Returns only matching records.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Customers who made orders  &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%2Fcuhd4bi3nf4iznyar26v.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%2Fcuhd4bi3nf4iznyar26v.png" alt="INNER JOIN Diagram" width="800" height="726"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  2. LEFT JOIN
&lt;/h3&gt;

&lt;p&gt;Returns all records from the left table and matching ones from the right.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; All customers, including those without orders  &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%2Fdct0bzzeskmzl34g5g7b.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%2Fdct0bzzeskmzl34g5g7b.png" alt="LEFT JOIN Diagram" width="800" height="858"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  3. RIGHT JOIN
&lt;/h3&gt;

&lt;p&gt;Returns all records from the right table and matching ones from the left.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; All orders, even if customer details are missing.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. FULL OUTER JOIN
&lt;/h3&gt;

&lt;p&gt;Returns all records from both tables.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; All customers and all orders  &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%2Fxr421h3qy7knfuio91wl.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%2Fxr421h3qy7knfuio91wl.png" alt="FULL OUTER JOIN Diagram" width="464" height="404"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  5. LEFT ANTI JOIN
&lt;/h3&gt;

&lt;p&gt;Returns rows from the left table with no match.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Customers who never ordered  &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%2Fpr0ut74p3zlwe7q1isq2.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%2Fpr0ut74p3zlwe7q1isq2.png" alt="LEFT ANTI JOIN Diagram" width="464" height="356"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  6. RIGHT ANTI JOIN
&lt;/h3&gt;

&lt;p&gt;Returns rows from the right table with no match.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Orders without customers  &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%2Fojmpyg30sr8m27krwazs.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%2Fojmpyg30sr8m27krwazs.png" alt="RIGHT ANTI JOIN Diagram" width="519" height="149"&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%2F3h1kkfnqf9irf19qmoot.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%2F3h1kkfnqf9irf19qmoot.png" alt=" " width="800" height="1040"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Joins in Power BI (Step-by-Step)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open Power BI Desktop
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Transform Data&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select a table
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Merge Queries&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select the second table
&lt;/li&gt;
&lt;li&gt;Choose matching columns
&lt;/li&gt;
&lt;li&gt;Select join type (Inner, Left, Right, Full, Anti)
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;OK&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Expand columns
&lt;/li&gt;
&lt;/ol&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%2F8cg3d59h7x749m4wr9gh.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%2F8cg3d59h7x749m4wr9gh.png" alt="Merge Queries window showing join type selection" width="689" height="626"&gt;&lt;/a&gt;  &lt;/p&gt;




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

&lt;p&gt;Relationships connect tables without merging them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of Relationships
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. One-to-Many (1:M)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
One record relates to many&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Example:&lt;/strong&gt; One customer → many orders  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Many-to-Many (M:M)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Both tables contain repeated values  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. One-to-One (1:1)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Each record matches exactly one  &lt;/p&gt;




&lt;h3&gt;
  
  
  Active vs Inactive
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Active: Used automatically
&lt;/li&gt;
&lt;li&gt;Inactive: Used only when specified
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Cardinality
&lt;/h3&gt;

&lt;p&gt;Defines how tables relate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One-to-many
&lt;/li&gt;
&lt;li&gt;Many-to-many
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Cross Filter Direction
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Single direction
&lt;/li&gt;
&lt;li&gt;Both directions
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Creating Relationships in Power BI (Step-by-Step)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Method 1: Model View
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;Model View&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Drag a column from one table to another
&lt;/li&gt;
&lt;/ol&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%2Flearn.microsoft.com%2Fen-us%2Fpower-bi%2Fguidance%2Fmedia%2Frelationships-many-to-many%2Fbank-account-customer-model-related-tables-1.svg" 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%2Flearn.microsoft.com%2Fen-us%2Fpower-bi%2Fguidance%2Fmedia%2Frelationships-many-to-many%2Fbank-account-customer-model-related-tables-1.svg" alt="Model view showing connected tables" width="808" height="486"&gt;&lt;/a&gt;  &lt;/p&gt;




&lt;h3&gt;
  
  
  Method 2: Manage Relationships
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Manage Relationships&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;New&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select tables
&lt;/li&gt;
&lt;li&gt;Select columns
&lt;/li&gt;
&lt;li&gt;Set cardinality
&lt;/li&gt;
&lt;li&gt;Choose cross-filter direction
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;OK&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;📸 &lt;em&gt;Insert Screenshot:&lt;/em&gt; Relationship configuration dialog box&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%2Fc221e174zprzpcqqiw8v.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%2Fc221e174zprzpcqqiw8v.png" alt=" Relationship configuration dialog box" width="602" height="537"&gt;&lt;/a&gt;  &lt;/p&gt;




&lt;h2&gt;
  
  
  Joins vs Relationships
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Joins&lt;/th&gt;
&lt;th&gt;Relationships&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Combine tables&lt;/td&gt;
&lt;td&gt;Link tables&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Power Query&lt;/td&gt;
&lt;td&gt;Model View&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Used in data preparation&lt;/td&gt;
&lt;td&gt;Used in analysis&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Fact vs Dimension Tables
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Fact Table
&lt;/h3&gt;

&lt;p&gt;Contains numeric data used for analysis.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sales
&lt;/li&gt;
&lt;li&gt;Revenue
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Dimension Table
&lt;/h3&gt;

&lt;p&gt;Contains descriptive data.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customer
&lt;/li&gt;
&lt;li&gt;Product
&lt;/li&gt;
&lt;li&gt;Date
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Data Schemas
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Star Schema
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;One central fact table
&lt;/li&gt;
&lt;li&gt;Connected dimension tables
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use case:&lt;/strong&gt; Best for Power BI performance  &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%2Fcdn.prod.website-files.com%2F676a9690ef4ec151a69571ff%2F67c886dd231dbd74497b2887_Group%252023137332-min.avif" 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%2Fcdn.prod.website-files.com%2F676a9690ef4ec151a69571ff%2F67c886dd231dbd74497b2887_Group%252023137332-min.avif" alt="STAR SCHEMA Diagram" width="1765" height="1069"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Snowflake Schema
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Dimension tables split into smaller related tables
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use case:&lt;/strong&gt; Complex datasets&lt;br&gt;&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%2Fzrex4ccybztjuju87c5o.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%2Fzrex4ccybztjuju87c5o.png" alt="SNOWFLAKE SCHEMA" width="800" height="485"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Flat Table (DLAT)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;All data in one table
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use case:&lt;/strong&gt; Small or simple datasets &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%2Fcdn.prod.website-files.com%2F65d605a3b4417479c154329f%2F65f024b6b51652f355e8fc55_Table-16-Zebra-Stripes-Chaos.svg" 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%2Fcdn.prod.website-files.com%2F65d605a3b4417479c154329f%2F65f024b6b51652f355e8fc55_Table-16-Zebra-Stripes-Chaos.svg" alt="FLAT TABLE Diagram" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Role-Playing Dimensions
&lt;/h2&gt;

&lt;p&gt;A single dimension used multiple times.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Order Date
&lt;/li&gt;
&lt;li&gt;Ship Date
&lt;/li&gt;
&lt;li&gt;Delivery Date
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Common Data Modeling Issues
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Duplicate keys
&lt;/li&gt;
&lt;li&gt;Incorrect relationships
&lt;/li&gt;
&lt;li&gt;Many-to-many confusion
&lt;/li&gt;
&lt;li&gt;Circular relationships
&lt;/li&gt;
&lt;li&gt;Poor performance
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Best Practices
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use star schema
&lt;/li&gt;
&lt;li&gt;Keep models simple
&lt;/li&gt;
&lt;li&gt;Avoid unnecessary joins
&lt;/li&gt;
&lt;li&gt;Validate relationships
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Data modeling is the foundation of Power BI. Understanding joins, relationships, and schemas helps build accurate, efficient, and scalable reports.&lt;/p&gt;

</description>
      <category>powebi</category>
      <category>dataanalytics</category>
      <category>datamodeling</category>
    </item>
    <item>
      <title>From Spreadsheets to Insights: How Excel is Used in Real-World Data Analysis</title>
      <dc:creator>Enock Kiprotich</dc:creator>
      <pubDate>Tue, 24 Mar 2026 16:19:51 +0000</pubDate>
      <link>https://dev.to/enockdata/from-spreadsheets-to-insights-how-excel-is-used-in-real-world-data-analysis-2lbh</link>
      <guid>https://dev.to/enockdata/from-spreadsheets-to-insights-how-excel-is-used-in-real-world-data-analysis-2lbh</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In today’s digital world, data is everywhere. Organizations collect large amounts of information daily, but raw data alone has little value unless it is properly analyzed and interpreted. This is where Microsoft Excel becomes essential. Excel is more than just a spreadsheet tool—it is a practical solution used to transform raw data into meaningful insights that support decision-making.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Excel?
&lt;/h2&gt;

&lt;p&gt;Microsoft Excel is a spreadsheet application developed by Microsoft that allows users to organize, store, and analyze data in a structured format using rows and columns. It provides powerful features such as formulas, functions, and data visualization tools that make it easier to process and understand data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Applications of Excel
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Business and Financial Analysis
&lt;/h3&gt;

&lt;p&gt;In business environments, Excel is widely used to support financial decision-making. Organizations rely on it to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Track sales performance
&lt;/li&gt;
&lt;li&gt;Monitor expenses and budgets
&lt;/li&gt;
&lt;li&gt;Analyze profits and losses
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By using Excel, businesses can make informed decisions based on actual data rather than assumptions.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Healthcare Data Management
&lt;/h3&gt;

&lt;p&gt;In healthcare, Excel helps improve efficiency and organization by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Managing patient records
&lt;/li&gt;
&lt;li&gt;Tracking medical supplies and inventory
&lt;/li&gt;
&lt;li&gt;Generating reports for planning and resource allocation
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Accurate data management in Excel contributes to better service delivery.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Data Analysis and Reporting
&lt;/h3&gt;

&lt;p&gt;Excel is a key tool for data analysts. It is commonly used to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clean and organize raw data
&lt;/li&gt;
&lt;li&gt;Identify trends and patterns
&lt;/li&gt;
&lt;li&gt;Create reports and dashboards
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This allows analysts to turn complex datasets into clear and actionable insights.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Government and Public Sector Use
&lt;/h3&gt;

&lt;p&gt;In public institutions, Excel supports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data digitization and record keeping
&lt;/li&gt;
&lt;li&gt;Statistical analysis and reporting
&lt;/li&gt;
&lt;li&gt;Preparation of reports for decision-making
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It plays an important role in improving efficiency and transparency.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features and Functions in Excel
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Basic Functions
&lt;/h3&gt;

&lt;p&gt;Excel provides essential functions that simplify calculations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;=SUM(A1:A10)&lt;/code&gt; – Adds a range of values
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;=AVERAGE(A1:A10)&lt;/code&gt; – Calculates the average
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;=COUNT(A1:A10)&lt;/code&gt; – Counts the number of entries
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Logical Functions
&lt;/h3&gt;

&lt;p&gt;Logical functions help automate decision-making:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;=IF(A1&amp;gt;=50,"Pass","Fail")&lt;/code&gt;
This formula evaluates a condition and returns a result.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Lookup Functions
&lt;/h3&gt;

&lt;p&gt;Lookup functions make it easy to retrieve specific data:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;=VLOOKUP(A2, A1:C10, 2, FALSE)&lt;/code&gt;
This searches for a value and returns related data from a table.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Error Handling
&lt;/h3&gt;

&lt;p&gt;To handle errors in calculations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;=IFERROR(A1/B1,"Error")&lt;/code&gt;
This prevents formulas from displaying error messages.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Data Analysis Tools
&lt;/h3&gt;

&lt;p&gt;Excel also includes advanced tools such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pivot Tables for summarizing large datasets
&lt;/li&gt;
&lt;li&gt;Charts (bar, line, pie) for visualization
&lt;/li&gt;
&lt;li&gt;Sorting and filtering for organizing data
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Practical Example
&lt;/h2&gt;

&lt;p&gt;For instance, a business can use Excel to analyze monthly sales data. By applying functions like SUM and using Pivot Tables, the business can identify top-performing products and trends. This information helps managers make informed decisions and improve performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Microsoft Excel remains one of the most important tools for real-world data analysis. Its ability to organize, analyze, and visualize data makes it valuable across different industries. Whether in business, healthcare, or government, Excel helps transform raw data into meaningful insights that drive better decision-making.&lt;/p&gt;




&lt;h1&gt;
  
  
  Tags
&lt;/h1&gt;

&lt;h1&gt;
  
  
  excel #dataanalysis #beginners #luxdevhq.ai
&lt;/h1&gt;

</description>
    </item>
  </channel>
</rss>
