<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Data Ground Up]]></title><description><![CDATA[Learn Data from the Ground Up with me]]></description><link>https://datagroundup.com</link><image><url>https://substackcdn.com/image/fetch/$s_!_Ib6!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94d9a9b8-b36f-4e02-8e72-0689b2a0ee2d_1024x1024.png</url><title>Data Ground Up</title><link>https://datagroundup.com</link></image><generator>Substack</generator><lastBuildDate>Thu, 16 Apr 2026 05:38:37 GMT</lastBuildDate><atom:link href="https://datagroundup.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Levi]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[datagroundup@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[datagroundup@substack.com]]></itunes:email><itunes:name><![CDATA[Levi]]></itunes:name></itunes:owner><itunes:author><![CDATA[Levi]]></itunes:author><googleplay:owner><![CDATA[datagroundup@substack.com]]></googleplay:owner><googleplay:email><![CDATA[datagroundup@substack.com]]></googleplay:email><googleplay:author><![CDATA[Levi]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[AI Slowly Degrades Your Skills]]></title><description><![CDATA[How To Fight Against It]]></description><link>https://datagroundup.com/p/ai-slowly-degrades-your-skills</link><guid isPermaLink="false">https://datagroundup.com/p/ai-slowly-degrades-your-skills</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Sat, 28 Mar 2026 10:11:52 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f9395a29-5f0e-45eb-bd7c-d21df614777c_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It is really easy to default to AI coding today.</p><p>All the IDEs have built-in tab completions and chat interfaces to discuss the codebase with AI. Some others were built around AI coding entirely. You don&#8217;t even need a text editor anymore, just a chat interface, and AI will edit all the code files for you.</p><p>Vibecoding is a hot topic today, and people have started to use it even in their work or production code.</p><p>But where does it lead? </p><p>If you tried AI coding, you probably noticed that it is really hard to go back. You actually need to think again. Humans are lazy. We don&#8217;t want to think anymore. It&#8217;s so comfortable to &#8220;prompt code&#8221; and note &#8220;problem solve code&#8221;.</p><p>And whenever you must go back to general coding, it feels so painful. We got addicted to AI, and we have withdrawal symptoms without it. It&#8217;s like going to the toilet without your phone. You cannot poop if you don&#8217;t scroll TikTok.</p><p>I need to use the documentation even for the basic syntax. I could maybe code a basic for loop, but I don&#8217;t trust my brain anymore. AI degraded my skills, so it&#8217;s time to do something.</p><p>I wrote a post about slowing down, but it is really hard to slow down today. Here is what I plan to do</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;e6bfbe90-1690-4346-8279-e0d90a1ae960&quot;,&quot;caption&quot;:&quot;It&#8217;s been a while since the last post here on this blog/newsletter.&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Time for a Comeback&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:75251854,&quot;name&quot;:&quot;Levi&quot;,&quot;bio&quot;:&quot;I explain Data Science on Grandma's level.&quot;,&quot;photo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03314f91-81c1-4d82-9cbc-d2cca2578799_400x400.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2026-02-16T13:03:02.758Z&quot;,&quot;cover_image&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a3f43cf5-5ea8-4f7b-a3c5-6c3bea21768b_1456x1048.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://datagroundup.com/p/here-we-go-again&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:187952079,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:4,&quot;comment_count&quot;:0,&quot;publication_id&quot;:2473003,&quot;publication_name&quot;:&quot;Data Ground Up&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!_Ib6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94d9a9b8-b36f-4e02-8e72-0689b2a0ee2d_1024x1024.png&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><h2>How to fight against AI degrading our skills</h2><h3>No AI coding sessions</h3><p>In the morning, work on a project without AI. Switch off tab completion, no AI chat, or for hard mode, switch on airplane mode. That&#8217;s elite-level OG coding. Force yourself not to use AI. </p><p>You must understand your code, and it forces you to problem-solve again. This makes coding fun again. </p><p>Start small, build hobby projects, read the documentation, or even Stack Overflow. (Yes, that site still exists.) You almost need to relearn coding.</p><h3>Coding challenges without AI</h3><p>If you don&#8217;t want to start an entire hobby project, just go to a challenge site like HackerRank or LeetCode. These are great sites for quick practice problems where you can get back into the habit of no AI coding. </p><p>You don&#8217;t even need to change your regular coding environment to switch off AI. Their built-in coding editor works perfectly for Non-AI practice.</p><p>I just found <a href="https://adventofcode.com/">Advent of Code</a>, and I will try to solve the challenges myself to learn.</p><h3>Type out the AI response</h3><p>This is the middle ground. Using AI, but no copy-paste allowed. </p><p>Pasting AI output without reading it is the real problem. If you type it out, you force yourself to read it, and while typing, you can understand the code. It&#8217;s not problem solving, but at least the code understanding part is there. </p><p>If you only listen to English podcasts and read in English, your speaking will not develop. Same with coding. You actually need to &#8220;problem-solve code&#8221; to develop real skills. But understanding is still better than nothing.</p>]]></content:encoded></item><item><title><![CDATA[Being busy is lame]]></title><description><![CDATA[I am sure you know at least one person who is always busy.]]></description><link>https://datagroundup.com/p/being-busy-is-lame</link><guid isPermaLink="false">https://datagroundup.com/p/being-busy-is-lame</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Wed, 11 Mar 2026 17:03:21 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/cf1bb26f-e01a-4cae-9fdc-f07beccffbb0_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I am sure you know at least one person who is always busy. They always stare at their screen, answer work e-mails, jump from meeting to meeting, and they are the first person in the office and the last to leave. Their overtime sheet is full, and they have no time for a 20-minute break or coffee chat. They work so hard, but they actually do nothing.</p><p>I am sure you know at least one person who is never busy. They have regular breaks away from the keyboard, they do only a few meetings a week, they never work overtime, and they are happy to go with you for a quick chat over a coffee.</p><p>Probably the output of the 2 person above is the same, or even the second person is more effective.</p><p>Busyness is a personality thing, and 9 out of 10 busy people are just unorganised. Of course, it can be affected by company culture, but even within the same environment, I have met both personality types. Also, everyone has busy periods, and sometimes you cannot avoid them. But generally, being busy is lame.</p><p>I think people should aim to be part of the never-busy group.</p><h2>Being busy</h2><p>The busy people usually have their own great mantras for why they are so busy.</p><p>&#8220;The management will notice how hard I try.&#8221;</p><p>&#8220;I am so motivated to be promoted, so I work a lot.&#8221;</p><p>&#8220;Let&#8217;s organize a call so we can go into the deep details and understand the process.&#8221;</p><p>&#8220;I am a maximalist, and everything needs to be perfect.&#8221;</p><p>&#8220;I have no time to rest, the deadline is so close.&#8221;</p><p>Let me tell you this:</p><ul><li><p>Management only cares about the outputs and KPIs.</p></li><li><p>This person will be the first to burn out.</p></li><li><p>&#8216;Deep understanding&#8217; of the process usually leads to overcomplicating things. More below.</p></li><li><p>Perfect means balance in many aspects. Busy people usually hunt perfect in a few aspects and sacrifice others.</p></li><li><p>A 20-minute break will not necessarily result in a 20-minute delay. Great ideas can come in great breaks.</p></li></ul><p>Busy people are also usually loud. They want to be visible, and they want to show how much they do. But their loudness is just noise and not actual important buzz. They want to be part of every conversation because they like to hear about things, but most of the time, they cannot add to the conversation.</p><p>They tend to micromanage. They want to know everything, but they have no time for the real details, so they know nothing. They see only the surface and usually have no value to add.</p><p>They are busy because they chose to be so. Being busy can be a decision for most people, or at least everyone should have some sort of influence on how busy they are. Being busy is not equal to being better in your job. It will have many consequences that are usually not positive. Busy people usually sacrifice work-life balance, rest, and are more stressed and harder to work with.</p><p>Busy people are present in the most calm environment as well, but the hustle culture can multiply their bad habits.</p><h2>Being not so busy</h2><p>Less busy people are not less busy because they are not motivated or lazy. In fact, they are usually less busy because they already took the time to learn stuff (like automation, the tools, time management, etc., see below) and chose to be less busy.</p><p>People are usually less busy because:</p><p><strong>They optimize for output and not bullshit.</strong> Planning and discussing projects is a must, but when you spend more time in meetings than actually implementing, the process is flawed.</p><p><strong>They automate their processes.</strong> When you have automations working for you, you have more time for other things, simple.</p><p><strong>They know what tools to use for a given task.</strong> For a simple data analysis, Excel will do the job. For multi-line text editing or list comparison, use VS Code. You don&#8217;t need the fancy, shiny tool to be effective at work.</p><p><strong>They spend time learning the tools they work with.</strong> Learn the keyboard shortcuts, learn the basic functions in Excel, spend some time on YouTube, and watch how experienced people use the tools you also use.</p><p><strong>They organize their days effectively.</strong> Time-management is also a skill. Calendar boxing and organized to-do lists can help to be organized. Find something that fits your needs and personality. The internet is full of productivity tips.</p><p><strong>They are quiet, but they are good listeners.</strong> They focus on the results, and they are successful because of them and not because of the noise they cause.</p><p><strong>They know how to allocate resources and assign tasks.</strong> The broad picture is enough for them to add clear instructions that lead to a calm, but productive environment.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datagroundup.com/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Automation I Use To Be Fast]]></title><description><![CDATA[In the last post, I wrote about the scripts I use to make typing and coding faster.]]></description><link>https://datagroundup.com/p/automation-i-use-to-be-fast</link><guid isPermaLink="false">https://datagroundup.com/p/automation-i-use-to-be-fast</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Sat, 28 Feb 2026 14:01:28 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/bcf5031d-ae51-4f16-b0c0-d1877284d533_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the last post, I wrote about the scripts I use to make typing and coding faster. In this one I will share some more AHK scripts that I use daily.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;2b071bd4-83b5-4967-a42c-cf71af343c0c&quot;,&quot;caption&quot;:&quot;I love automation&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;How I Save Time While Typing Code&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:75251854,&quot;name&quot;:&quot;Levi&quot;,&quot;bio&quot;:&quot;I explain Data Science on Grandma's level.&quot;,&quot;photo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03314f91-81c1-4d82-9cbc-d2cca2578799_400x400.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2026-02-23T15:42:41.894Z&quot;,&quot;cover_image&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c5effa9b-8dd0-4ac1-bcc9-5235cb290815_1456x1048.jpeg&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://datagroundup.com/p/how-i-save-time-while-typing-code&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:188901609,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:6,&quot;comment_count&quot;:0,&quot;publication_id&quot;:2473003,&quot;publication_name&quot;:&quot;Data Ground Up&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!_Ib6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94d9a9b8-b36f-4e02-8e72-0689b2a0ee2d_1024x1024.png&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><h2>Hotkeys</h2><p>I use my numpad as a macropad. It allows me to assign specific numbers to specific apps. Windows has this function built in, but it is not as reliable as AHK. Crazy how a scripting tool can interact with Windows better than Windows itself.</p><pre><code><code>OpenPBI() 
{
    if WinExist("ahk_exe PBIDesktop.exe") {
        winactivate
    }
    else
        Run("C:\Program Files\Microsoft Power BI Desktop\bin\PBIDesktop.exe")
}

OpenCode() 
{
    if WinExist("ahk_exe Code.exe") {
        winactivate
    }
    else
        Run("Code.exe")
}

&lt;^Numpad2:: OpenPBI()
&lt;^Numpad6:: OpenCode()
</code></code></pre><p>I like to organize AHK scripts according to the above structure, having functions and hotkeys separated. You could have a hotkey &#8594; script, but that is not as easy to search through.</p><p>I have 2 functions here, <code>OpenPBI</code> is the first. This function checks if I have a Power BI instance open, and if I do, it will activate the window. If I don&#8217;t have one open, then it will run the exe for me.</p><p>This function alone is not a working code; I need to assign it to a hotkey. In this case, it is <code>Left Ctrl</code> + <code>Numpad2</code>. The other function does the same thing with VS Code. Previously, I was a big <code>Alt</code> + <code>Tab</code> guy, but that changed with AHK. It makes it super easy to navigate between apps, and it is smooth as well. In AHK scripts <code>^</code> = <code>Ctrl</code></p><pre><code><code>OpenEdgeNewWindow() {
    if WinExist("ahk_exe msedge.exe")
    {
        WinActivate
        Send("^t")
    }
    else
    {
        Run("C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe")
        Send("^t")
    }
}

&lt;^!Numpad1:: OpenEdgeNewWindow()
</code></code></pre><p>The above one is an extended version of the previous code. It will open Edge, but also send the keyboard keys <code>Ctrl</code> + <code>t</code>. <code>Ctrl</code> + <code>t</code> opens a new window in most browsers. So if I press <code>Left Ctrl</code> + <code>Alt</code> + <code>Numpad1,</code> a new browser window will open. In AHK scripts <code>!</code> = <code>Alt</code>.</p><pre><code><code>SearchSQLBI()
{
    Send("+!{Right}")
    Sleep(10)
    Send("^c")
    Sleep(100)
    Run("https://dax.guide/" . A_Clipboard)
}

^!Numpad5:: SearchSQLBI()
</code></code></pre><p>If you code DAX a lot, the above can be super useful, since in the built-in PBI editor, there is no great documentation for the functions. The code will select the word currently under the cursor, and it will open the DAX guide with the given word in the link. I click into the function name, hit the shortcut, and boom, I have the docs right in front of me:</p><div class="native-video-embed" data-component-name="VideoPlaceholder" data-attrs="{&quot;mediaUploadId&quot;:&quot;d52d3f93-0242-433e-afc9-835d595d4974&quot;,&quot;duration&quot;:null}"></div><p>Another great one is the DAX Code Formatter shortcut I have:</p><pre><code><code>^+f::  ; Ctrl + Shift + F
{
    try {
        ; Copy selected text
        Send("^c")
        Sleep(200)  ; Wait for clipboard to update

        daxCode := A_Clipboard

        ; URL encode the DAX code
        encodedDax := UriEncode(daxCode)

        ; Build the full URL
        url := "https://www.daxformatter.com/?embed=1&amp;l=long&amp;s=true&amp;fx=" . encodedDax

        ; Open in Browser
        Run url
    }
}

; Function to URL-encode text
UriEncode(str) {
    static chars := "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.~"
    out := ""
    Loop Parse, str
    {
        ch := A_LoopField
        if InStr(chars, ch)
            out .= ch
        else
            out .= "%" . Format("{:02X}", Ord(ch))
    }
    return out
}
</code></code></pre><p>I select the DAX code, hit the shortcut, and it will open the DAX Formatter page with the code. I just need to copy-paste the result.</p><div class="native-video-embed" data-component-name="VideoPlaceholder" data-attrs="{&quot;mediaUploadId&quot;:&quot;ce4f5b77-0c7c-4276-a34e-de417936be77&quot;,&quot;duration&quot;:null}"></div><h2>Extend functionality with a GUI</h2><p>I usually need to transform text into uppercase, lowercase or title case. Here is a script I use to make it faster:</p><pre><code><code>Edittext()
{
    MyMenu := Menu()
    MyMenu.add("Uppercase", Menuhandler)
    MyMenu.add("Lowercase", Menuhandler)
    MyMenu.add("Title", Menuhandler)
    MyMenu.Show()
}

Menuhandler(Item, *) {
    A_Clipboard :=""
    Send "^c"
    ClipWait

    switch Item{
        case "Uppercase":
            SendText(StrUpper(A_Clipboard))
        case "Lowercase":
            SendText(StrLower(A_Clipboard))
        case "Title":
            SendText(StrTitle(A_Clipboard))
    }
}
</code></code></pre><p>I select the text, use the shortcut, and a GUI will pop up so I can choose what type of transformation I want:</p><div class="native-video-embed" data-component-name="VideoPlaceholder" data-attrs="{&quot;mediaUploadId&quot;:&quot;ae36c1f8-8214-46d0-806f-6bf1c294cf13&quot;,&quot;duration&quot;:null}"></div><p>Built-in GUI for AHK is dynamite. You can extend these functionalities a lot. I hope this was a great inspiration, and you might find something useful in these. Let me know if you did so and have some other ideas for automation.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://datagroundup.com/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[How I Save Time While Typing Code]]></title><description><![CDATA[The hotstrings I use]]></description><link>https://datagroundup.com/p/how-i-save-time-while-typing-code</link><guid isPermaLink="false">https://datagroundup.com/p/how-i-save-time-while-typing-code</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Mon, 23 Feb 2026 15:42:41 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c5effa9b-8dd0-4ac1-bcc9-5235cb290815_1456x1048.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>I love automation</h2><p>Is there a better feeling than automating repetitive tasks? I freaking love it. This got me into programming, and to this date, that gives me the most joy. Knowing that I never need to do the same boring thing is dynamite.</p><p>I work on Windows, and I use it on my personal computer as well. I know... I am not a real computer enthusiast until I move to a proper Linux distro, but that will probably come sooner or later.</p><p>Until then, I am really grateful for AutoHotkey. The day I installed it on my work profile, my life changed. It is so powerful that every user who cares about time-saving should use it. Super easy to create beginner-friendly scripts. It is a great way to learn programming as well.</p><p>In the coming posts, I will share some scripts I have, starting with hotstrings.</p><p>Let me know if you see room for improvement or how you use automation for everyday tasks.</p><h2>Hotstrings</h2><p>Let&#8217;s start with an example:</p><pre><code><code>::btw::by the way</code></code></pre><p>The abbreviation <code>btw</code> will be automatically replaced with <code>"by the way"</code> when I trigger it with an ending character such as <code>Space</code>.</p><p>Using the logic above, you can create shortcuts to your name, email, or even longer strings that you type many times, like some general email templates.</p><pre><code><code>::_mail::Johndoe@gmail.com
::_name::John Doe

::text1::
(
Any text between the top and bottom parentheses is treated literally.
By default, the hard carriage return (Enter) between the previous line and this one is also preserved.
    By default, the indentation (tab) to the left of this line is preserved.
)</code></code></pre><div class="native-video-embed" data-component-name="VideoPlaceholder" data-attrs="{&quot;mediaUploadId&quot;:&quot;9d247bb8-d3f7-4936-a0c9-97880a934dd7&quot;,&quot;duration&quot;:null}"></div><p>Basically, Hotstrings are simple text replacement tools. They are easy to create and super fast with AHK.</p><p>I also have a few SQL-specific hotstrings:</p><pre><code><code>::sel::SELECT
::seldis::SELECT DISTINCT
::sdis::SELECT DISTINCT
::cw::CASE WHEN
::wh::WHERE 
::gr::GROUP BY
::gb::GROUP BY
</code></code></pre><p>You can add your most-used tables and filters. Most SQL editors provide this functionality, but AHK is super fast, and the hotstrings are easy to define, so I would always default to it instead of creating these in the SQL editor.</p><h3>Modifiers and Hotif</h3><p>You can define hotstrings with several modifiers and their combination:</p><p><code>C</code> - Case-sensitive trigger<br><code>*</code> - Trigger even without an ending character<br><code>?</code> - Trigger inside other words<br><code>O</code> - Omit the ending character</p><p>There is also another awesome functionality, the Hotif modifier.</p><p>You can wrap your hotstrings (and hotkeys) between Hotifs, and your code becomes context sensitive.</p><p>For example, the below will limit my hotstrings to Power BI. This feature allows me to define the same hotstrings for different apps with different actions.</p><p>Here is the example that combines the hotifs and modifiers:</p><pre><code><code>#Hotif winactive("ahk_exe PBIDesktop.exe")

:O:cal::CALCULATE(){Left}
:O:cr::COUNTROWS(){Left}
:O:ret::RETURN{Shift down}{Enter}{Shift up}
:CO:var::VAR _
:CO:VAR::VAR _
::sel::SELECTEDVALUE(){Left}
::sv::SELECTEDVALUE(){Left}
::kf::KEEPFILTERS(){Left}
::rf::REMOVEFILTERS(){Left}
::treatval::TREATAS(VALUES( )){Left}{Left}
::swtrue::SWITCH(TRUE(), ){Left}{Shift down}{Enter}{Shift up}

#Hotif
</code></code></pre><p>Another feature present in this code is the key input action. For example, when I type <code>cal</code> in Power BI and trigger the action with a space, AHK will &#8220;type&#8221; <code>CALCULATE()</code> then it will simulate the <code>Left</code> keypress to go into the brackets.</p><div class="native-video-embed" data-component-name="VideoPlaceholder" data-attrs="{&quot;mediaUploadId&quot;:&quot;2c89a4bc-18c4-4d45-b439-efdf935d22a9&quot;,&quot;duration&quot;:null}"></div><h2>Autocorrect</h2><p>Hopefully, you now see how hotstrings can change the way you code or type in general, but the biggest improvement AHK hotstrings can provide is a unique autocorrect script that can be adjusted to address your frequent typos.</p><p>Here is a great repository that already has thousands of corrections, and you can easily extend the list. It has a built-in GUI as well, so you can quickly add some words or substrings.</p><p><a href="https://github.com/kunkel321/AutoCorrect2">https://github.com/kunkel321/AutoCorrect2</a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LIPW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd06db4cc-bafe-414e-a802-21d6a9b9c477_776x593.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LIPW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd06db4cc-bafe-414e-a802-21d6a9b9c477_776x593.png 424w, https://substackcdn.com/image/fetch/$s_!LIPW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd06db4cc-bafe-414e-a802-21d6a9b9c477_776x593.png 848w, https://substackcdn.com/image/fetch/$s_!LIPW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd06db4cc-bafe-414e-a802-21d6a9b9c477_776x593.png 1272w, https://substackcdn.com/image/fetch/$s_!LIPW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd06db4cc-bafe-414e-a802-21d6a9b9c477_776x593.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LIPW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd06db4cc-bafe-414e-a802-21d6a9b9c477_776x593.png" width="776" height="593" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d06db4cc-bafe-414e-a802-21d6a9b9c477_776x593.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:593,&quot;width&quot;:776,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31148,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/188901609?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd06db4cc-bafe-414e-a802-21d6a9b9c477_776x593.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LIPW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd06db4cc-bafe-414e-a802-21d6a9b9c477_776x593.png 424w, https://substackcdn.com/image/fetch/$s_!LIPW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd06db4cc-bafe-414e-a802-21d6a9b9c477_776x593.png 848w, https://substackcdn.com/image/fetch/$s_!LIPW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd06db4cc-bafe-414e-a802-21d6a9b9c477_776x593.png 1272w, https://substackcdn.com/image/fetch/$s_!LIPW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd06db4cc-bafe-414e-a802-21d6a9b9c477_776x593.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This script is genius, it works in the background seamlessly, and is quick and efficient. </p><p>Hotstrings are just the entry-level stuff that AHK provides. Next time, I will share some Hotkeys that I use with more advanced scripts. </p><p></p>]]></content:encoded></item><item><title><![CDATA[Time for a Comeback]]></title><description><![CDATA[Are You Still There?]]></description><link>https://datagroundup.com/p/here-we-go-again</link><guid isPermaLink="false">https://datagroundup.com/p/here-we-go-again</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Mon, 16 Feb 2026 13:03:02 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/a3f43cf5-5ea8-4f7b-a3c5-6c3bea21768b_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It&#8217;s been a while since the last post here on this blog/newsletter. </p><p>Now I feel like it is a time for a comeback.</p><h1>What happened?</h1><p>I just had a super busy year on the work and personal front as well, but I also just wanted to be away from content. </p><p>Probably most of you are here because you followed me on Twitter. That was my main platform before it became a shitshow. That is where I felt at home, and that was really my style: Short content packed with visuals. </p><p>Moving to Substack was hard. Even though it is a nice platform with a lot of potential and great creators all around, it&#8217;s needless to say that it is different. In my &#8220;blogging&#8220; journey, I always created threads, short tweets, and now I am staring at a blank wall that waits for me to fill it with endless words. No character limits, just the empty editor. </p><p>When I write here, I feel that the content should be long and well-edited, like in a book. Twitter was loose and comfy, while Substack feels like the elite club, and I need to be well-dressed to belong here. </p><p>I didn&#8217;t like it originally, but now I see why this place might still be a good fit for me. </p><p><strong>I learned to slow down.</strong> Twitter is also like TikTok, a constant fast-paced dopamine hit. That&#8217;s how I consumed and created content. I ran 365 sprints a year with my daily content. I thought creating on Substack is the ultimate marathon.  The truth is probably in the middle. While it&#8217;s a &#8220;longer distance&#8221; to publish something here, it&#8217;s not a full marathon. And I feel way more comfortable running those distances than I did a year before. </p><p>We are living in an extremely fast-paced world. Tech is changing with every blink, AI is faster than a Ferrari, and slowing down here feels strange. <strong>But I must do it, I feel like</strong>. Running super fast all the time will not train you to run the longer distances.</p><p><strong>How did I arrive here?</strong> </p><p>I work a lot in Power BI these days, and I needed to deepen my DAX knowledge. The best resources for that are the <a href="https://www.sqlbi.com/books/the-definitive-guide-to-dax-third-edition/">Definitive Guide to DAX Book</a> and the <a href="https://www.sqlbi.com/">SQLBI articles</a> in general. And if you work with Power BI, it might not surprise you, but advanced DAX is haaaard. Every problem will hit you with a new challenge, and when you feel you learned something, it will just keep you grounded and humble. I need to reread articles and chapters all the time, and with each reread, I notice something new. </p><p>The authors make it very clear in the intro that this should be the way to do it:</p><div class="pullquote"><p>Yes, if you want to leverage the real power of DAX, you need to be prepared for a long journey with us, reading the book from cover to cover, and then reading it again, searching for the many details that&#8212;at first sight &#8212;are not obvious.</p></div><p>The journey of learning DAX taught me that vibe coding is not the way. Programming in general requires you to master the basics and cannot jump right into the advanced stuff. <strong>No quick free lunch in this field, and writing good content might be the same.</strong> </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yeSB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6554d943-ae1e-430a-a65e-53d92f0f5d43_1192x904.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yeSB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6554d943-ae1e-430a-a65e-53d92f0f5d43_1192x904.png 424w, https://substackcdn.com/image/fetch/$s_!yeSB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6554d943-ae1e-430a-a65e-53d92f0f5d43_1192x904.png 848w, https://substackcdn.com/image/fetch/$s_!yeSB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6554d943-ae1e-430a-a65e-53d92f0f5d43_1192x904.png 1272w, https://substackcdn.com/image/fetch/$s_!yeSB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6554d943-ae1e-430a-a65e-53d92f0f5d43_1192x904.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yeSB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6554d943-ae1e-430a-a65e-53d92f0f5d43_1192x904.png" width="1192" height="904" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6554d943-ae1e-430a-a65e-53d92f0f5d43_1192x904.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:904,&quot;width&quot;:1192,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:192295,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/187952079?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6554d943-ae1e-430a-a65e-53d92f0f5d43_1192x904.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yeSB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6554d943-ae1e-430a-a65e-53d92f0f5d43_1192x904.png 424w, https://substackcdn.com/image/fetch/$s_!yeSB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6554d943-ae1e-430a-a65e-53d92f0f5d43_1192x904.png 848w, https://substackcdn.com/image/fetch/$s_!yeSB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6554d943-ae1e-430a-a65e-53d92f0f5d43_1192x904.png 1272w, https://substackcdn.com/image/fetch/$s_!yeSB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6554d943-ae1e-430a-a65e-53d92f0f5d43_1192x904.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h1>What will come?</h1><p>Previously, my content defined my days; now my days will define the content.</p><p>I will not push content if I have nothing to tell, just to send something out. I will not force myself to do things just because that&#8217;s great content. </p><p>We will still learn together, but I will write about things or projects that I am working on. Last year, I was too lazy, so it will also be some sort of motivation for me. </p><p>I want to learn about D3.js, Django, RAG, Dash, so many things on my list, but it will not be a rush. I will do some projects while learning and document the journey. If you are here for it and want to follow, then great, thank you. But if you don&#8217;t want to see it, please unsubscribe.</p><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[Pretty numbers in Python]]></title><description><![CDATA[In coding, large numbers are not pretty, and it's hard to interpret them.]]></description><link>https://datagroundup.com/p/pretty-numbers-in-python</link><guid isPermaLink="false">https://datagroundup.com/p/pretty-numbers-in-python</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Sat, 12 Jul 2025 12:38:10 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f2aa21f3-3fbc-4303-ac34-e51d0816bb60_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In coding, large numbers are not pretty, and it's hard to interpret them. It's fine until you don't need to show them to the user, because you can count the number of digits if needed, but you don't want that experience for the user.</p><p>Let's explore the options for making the output numbers more readable and easier to work with.</p><h3>The user experience</h3><p>Look at this:</p><p><code>15315633662</code></p><p>That is <strong>fifteen billion, three hundred fifteen million, six hundred thirty-three thousand, six hundred sixty-two</strong>. (Thank you ChatGPT)</p><p>To make it easier to read, here are some separators added: <code>15,315,633,662</code></p><p>But that is still a "hard to read" number. At this scale, the last few digits are probably not that relevant to many users. That's why we usually see numbers like:</p><p><code>15.32 billion</code></p><p><code>15.3B</code></p><p><code>15,316 million</code></p><p>Depending on how we want to communicate and round our number, all the above can present the same long value we have.</p><p><strong>To achieve an output like the above, you can use <a href="https://babel.pocoo.org/en/latest/index.html">Babel</a>.</strong></p><p>It is a Python library that assists in internationalizing and localizing applications.</p><p>To format numbers, you can use the <code>format_compact_decimal</code> method:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!96mn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c5462b-a36f-4ba3-b01f-d693c6b14683_598x499.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!96mn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c5462b-a36f-4ba3-b01f-d693c6b14683_598x499.png 424w, https://substackcdn.com/image/fetch/$s_!96mn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c5462b-a36f-4ba3-b01f-d693c6b14683_598x499.png 848w, https://substackcdn.com/image/fetch/$s_!96mn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c5462b-a36f-4ba3-b01f-d693c6b14683_598x499.png 1272w, https://substackcdn.com/image/fetch/$s_!96mn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c5462b-a36f-4ba3-b01f-d693c6b14683_598x499.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!96mn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c5462b-a36f-4ba3-b01f-d693c6b14683_598x499.png" width="598" height="499" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f2c5462b-a36f-4ba3-b01f-d693c6b14683_598x499.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:499,&quot;width&quot;:598,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28635,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/168143167?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c5462b-a36f-4ba3-b01f-d693c6b14683_598x499.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!96mn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c5462b-a36f-4ba3-b01f-d693c6b14683_598x499.png 424w, https://substackcdn.com/image/fetch/$s_!96mn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c5462b-a36f-4ba3-b01f-d693c6b14683_598x499.png 848w, https://substackcdn.com/image/fetch/$s_!96mn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c5462b-a36f-4ba3-b01f-d693c6b14683_598x499.png 1272w, https://substackcdn.com/image/fetch/$s_!96mn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2c5462b-a36f-4ba3-b01f-d693c6b14683_598x499.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>That looks way better now.</p><h3>Your experience</h3><p>To make formatting even more confusing, here are two numbers that can mean the same thing:</p><p><code>1,099.98</code></p><p><code>1.099,98</code></p><p>Note the commas and dots. The first is a US standard. It uses a comma for thousands and a dot for decimals. But in the EU, it is usually the other way around. For example, in Germany, they use a dot for thousands and a comma for decimals.</p><p>You can use Babel to resolve this confusion:</p><ul><li><p><code>parse_decimal('1,099.98', locale='en_US')</code> &#8594; converts it to <code>1099.98</code> as a float.</p></li><li><p><code>parse_decimal('1.099,98', locale='de')</code> &#8594; also converts to <code>1099.98</code>, respecting the German format.</p></li></ul><p>Now, imagine a situation when you need to work with files that are coming in from two different standards. Date formatting, currency formatting, and time zones... Pain in the neck for sure.</p><p>Babel has some sort of solution to all the above scenarios.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!UrMS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03d97049-40a6-4019-bf21-1ea78ab03f18_679x315.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UrMS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03d97049-40a6-4019-bf21-1ea78ab03f18_679x315.png 424w, https://substackcdn.com/image/fetch/$s_!UrMS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03d97049-40a6-4019-bf21-1ea78ab03f18_679x315.png 848w, https://substackcdn.com/image/fetch/$s_!UrMS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03d97049-40a6-4019-bf21-1ea78ab03f18_679x315.png 1272w, https://substackcdn.com/image/fetch/$s_!UrMS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03d97049-40a6-4019-bf21-1ea78ab03f18_679x315.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UrMS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03d97049-40a6-4019-bf21-1ea78ab03f18_679x315.png" width="679" height="315" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/03d97049-40a6-4019-bf21-1ea78ab03f18_679x315.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:315,&quot;width&quot;:679,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36542,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/168143167?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03d97049-40a6-4019-bf21-1ea78ab03f18_679x315.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UrMS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03d97049-40a6-4019-bf21-1ea78ab03f18_679x315.png 424w, https://substackcdn.com/image/fetch/$s_!UrMS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03d97049-40a6-4019-bf21-1ea78ab03f18_679x315.png 848w, https://substackcdn.com/image/fetch/$s_!UrMS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03d97049-40a6-4019-bf21-1ea78ab03f18_679x315.png 1272w, https://substackcdn.com/image/fetch/$s_!UrMS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03d97049-40a6-4019-bf21-1ea78ab03f18_679x315.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sD3k!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3e500a3-bd29-46e7-b32d-659c29776cf5_893x526.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sD3k!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3e500a3-bd29-46e7-b32d-659c29776cf5_893x526.png 424w, https://substackcdn.com/image/fetch/$s_!sD3k!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3e500a3-bd29-46e7-b32d-659c29776cf5_893x526.png 848w, https://substackcdn.com/image/fetch/$s_!sD3k!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3e500a3-bd29-46e7-b32d-659c29776cf5_893x526.png 1272w, https://substackcdn.com/image/fetch/$s_!sD3k!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3e500a3-bd29-46e7-b32d-659c29776cf5_893x526.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sD3k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3e500a3-bd29-46e7-b32d-659c29776cf5_893x526.png" width="893" height="526" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f3e500a3-bd29-46e7-b32d-659c29776cf5_893x526.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:526,&quot;width&quot;:893,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:79183,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/168143167?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3e500a3-bd29-46e7-b32d-659c29776cf5_893x526.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sD3k!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3e500a3-bd29-46e7-b32d-659c29776cf5_893x526.png 424w, https://substackcdn.com/image/fetch/$s_!sD3k!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3e500a3-bd29-46e7-b32d-659c29776cf5_893x526.png 848w, https://substackcdn.com/image/fetch/$s_!sD3k!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3e500a3-bd29-46e7-b32d-659c29776cf5_893x526.png 1272w, https://substackcdn.com/image/fetch/$s_!sD3k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff3e500a3-bd29-46e7-b32d-659c29776cf5_893x526.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I was working on a project that required pretty number outputs, and my research led to Babel. Easy solution, would recommend.</p>]]></content:encoded></item><item><title><![CDATA[This Tool Will 10x Your Analysis]]></title><description><![CDATA[Feature engineering is typically considered a Machine Learning tool.]]></description><link>https://datagroundup.com/p/this-tool-will-10x-your-analysis</link><guid isPermaLink="false">https://datagroundup.com/p/this-tool-will-10x-your-analysis</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Wed, 28 May 2025 12:03:02 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/62604bc8-7cbb-4ab9-8fd3-9934a7141c9e_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Feature engineering is typically considered a Machine Learning tool. But it is way more than that.</p><p>Feature engineering is when we modify or create columns or variables in our data.</p><p>You can use it in simple analysis as well, and you should. Here is why:</p><p>(At the end, I will show how I used it in my latest analysis)</p><h3>Data is usually limited</h3><p>We always say that more (quality) data is better. But data availability is usually limited. Sometimes it is intentional so we don&#8217;t store &#8220;unnecessary&#8221; info, or sometimes the source has gaps.</p><p>In either case, feature engineering can help you a lot. If data has gaps, you can fill them, and feature engineering is a must. In other cases, feature engineering can add some spice to the analysis.</p><h3>The power of feature engineering</h3><p>If you see a dataset that has only a few columns, don&#8217;t think immediately that it is not good for analysis. From a few useful columns, you can make (engineer) a lot of helpful features.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!P0q_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2765e5d3-9066-40d1-8e55-049da1e940fc_496x124.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!P0q_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2765e5d3-9066-40d1-8e55-049da1e940fc_496x124.png 424w, https://substackcdn.com/image/fetch/$s_!P0q_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2765e5d3-9066-40d1-8e55-049da1e940fc_496x124.png 848w, https://substackcdn.com/image/fetch/$s_!P0q_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2765e5d3-9066-40d1-8e55-049da1e940fc_496x124.png 1272w, https://substackcdn.com/image/fetch/$s_!P0q_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2765e5d3-9066-40d1-8e55-049da1e940fc_496x124.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!P0q_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2765e5d3-9066-40d1-8e55-049da1e940fc_496x124.png" width="496" height="124" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2765e5d3-9066-40d1-8e55-049da1e940fc_496x124.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:124,&quot;width&quot;:496,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:8246,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/164561903?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2765e5d3-9066-40d1-8e55-049da1e940fc_496x124.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!P0q_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2765e5d3-9066-40d1-8e55-049da1e940fc_496x124.png 424w, https://substackcdn.com/image/fetch/$s_!P0q_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2765e5d3-9066-40d1-8e55-049da1e940fc_496x124.png 848w, https://substackcdn.com/image/fetch/$s_!P0q_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2765e5d3-9066-40d1-8e55-049da1e940fc_496x124.png 1272w, https://substackcdn.com/image/fetch/$s_!P0q_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2765e5d3-9066-40d1-8e55-049da1e940fc_496x124.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Here are some ideas for this tiny table:</p><p><strong>From </strong><code>timestamp</code><strong>:</strong></p><ul><li><p><code>hour</code>, <code>day</code>, <code>weekday</code>, <code>month</code>, <code>is_weekend</code></p></li><li><p><code>time_of_day</code> (e.g. morning/afternoon/evening/night)</p></li><li><p><code>session_duration</code> (time diff between user activities)</p></li><li><p><code>days_since_last_activity</code></p></li><li><p><code>is_peak_hour</code> (based on business-defined hours)</p></li></ul><p><strong>From </strong><code>amount</code><strong>:</strong></p><ul><li><p><code>amount_bucket</code> (e.g. low/medium/high spender)</p></li><li><p><code>relative_amount</code> (compared to the user&#8217;s average)</p></li><li><p><code>rolling_avg_amount</code> (per user over a period)</p></li><li><p><code>spending_growth</code> (compared to the previous spend)</p></li></ul><p>Then, from these new columns, you can go even further, combine 2-3 columns, and build up features like a tree.</p><p>You have a lot of options to play with your data:</p><ul><li><p>Create new features:</p><ul><li><p>From <code>date_of_birth</code>, calculate <code>age</code></p></li></ul></li><li><p>Encode:</p><ul><li><p>Convert <code>education_level</code> into ordinal values (e.g. HS=1, BSc=2, MSc=3)</p></li></ul></li><li><p>Scale, normalize</p></li><li><p>Bin:</p><ul><li><p>Categorize <code>transaction_amount</code> into &#8220;low&#8221;, &#8220;medium&#8221;, &#8220;high&#8221;</p></li><li><p>Group <code>age</code> into buckets: &#8220;18&#8211;25&#8221;, &#8220;26&#8211;35&#8221;, etc.</p></li></ul></li><li><p>Extract:</p><ul><li><p>From <code>full_name</code>, extract <code>first_name</code></p></li><li><p>From <code>timestamp</code>, extract <code>weekday</code></p></li></ul></li><li><p>Aggregate:</p><ul><li><p>Count <code>number_of_purchases</code> per user</p></li><li><p>Calculate <code>average_order_value</code> per customer</p></li></ul></li><li><p>Text manipulation</p></li><li><p>Handle missing data:</p><ul><li><p>Use a binary flag column <code>income_missing</code> to indicate NAs</p></li></ul></li></ul><p>The more features you have in the raw data, the easier feature engineering is. You can exponentially increase the number of features, and with that, the value of your analysis.</p><p>To be good at feature engineering, you must have great domain knowledge. Everyone can subtract two dates from each other, but the real heroes create features a rookie would never think about.</p><p>Never underestimate a basic table, since with feature engineering, you can bring it to life!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Data Ground Up! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h3>A real example</h3><p>I am working with the subscribers&#8217; data from Substack.</p><p>One feature I added is the engagement score:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!k2gL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd47249e-a0e2-4d16-bde1-b354b4866570_2176x1104.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!k2gL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd47249e-a0e2-4d16-bde1-b354b4866570_2176x1104.png 424w, https://substackcdn.com/image/fetch/$s_!k2gL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd47249e-a0e2-4d16-bde1-b354b4866570_2176x1104.png 848w, https://substackcdn.com/image/fetch/$s_!k2gL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd47249e-a0e2-4d16-bde1-b354b4866570_2176x1104.png 1272w, https://substackcdn.com/image/fetch/$s_!k2gL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd47249e-a0e2-4d16-bde1-b354b4866570_2176x1104.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!k2gL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd47249e-a0e2-4d16-bde1-b354b4866570_2176x1104.png" width="1456" height="739" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bd47249e-a0e2-4d16-bde1-b354b4866570_2176x1104.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:739,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:178719,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/164561903?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd47249e-a0e2-4d16-bde1-b354b4866570_2176x1104.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!k2gL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd47249e-a0e2-4d16-bde1-b354b4866570_2176x1104.png 424w, https://substackcdn.com/image/fetch/$s_!k2gL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd47249e-a0e2-4d16-bde1-b354b4866570_2176x1104.png 848w, https://substackcdn.com/image/fetch/$s_!k2gL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd47249e-a0e2-4d16-bde1-b354b4866570_2176x1104.png 1272w, https://substackcdn.com/image/fetch/$s_!k2gL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd47249e-a0e2-4d16-bde1-b354b4866570_2176x1104.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I used only existing columns from the original df, but with this new feature, I can do a lot more interesting analysis.</p><p>Substack uses the ISO 2 codes to describe a country, but Plotly likes ISO 3 codes.</p><p>Here is a function to create the data I need:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ic_f!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b739ec2-e438-4a7b-9f76-f4019e0a6cf2_2606x1272.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ic_f!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b739ec2-e438-4a7b-9f76-f4019e0a6cf2_2606x1272.png 424w, https://substackcdn.com/image/fetch/$s_!Ic_f!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b739ec2-e438-4a7b-9f76-f4019e0a6cf2_2606x1272.png 848w, https://substackcdn.com/image/fetch/$s_!Ic_f!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b739ec2-e438-4a7b-9f76-f4019e0a6cf2_2606x1272.png 1272w, https://substackcdn.com/image/fetch/$s_!Ic_f!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b739ec2-e438-4a7b-9f76-f4019e0a6cf2_2606x1272.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ic_f!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b739ec2-e438-4a7b-9f76-f4019e0a6cf2_2606x1272.png" width="1456" height="711" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6b739ec2-e438-4a7b-9f76-f4019e0a6cf2_2606x1272.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:711,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:157730,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/164561903?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b739ec2-e438-4a7b-9f76-f4019e0a6cf2_2606x1272.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ic_f!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b739ec2-e438-4a7b-9f76-f4019e0a6cf2_2606x1272.png 424w, https://substackcdn.com/image/fetch/$s_!Ic_f!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b739ec2-e438-4a7b-9f76-f4019e0a6cf2_2606x1272.png 848w, https://substackcdn.com/image/fetch/$s_!Ic_f!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b739ec2-e438-4a7b-9f76-f4019e0a6cf2_2606x1272.png 1272w, https://substackcdn.com/image/fetch/$s_!Ic_f!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b739ec2-e438-4a7b-9f76-f4019e0a6cf2_2606x1272.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now I can use it with plotly to create charts like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!myqg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538cffba-6d07-4b2e-aa71-618e603d9b2a_1138x450.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!myqg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538cffba-6d07-4b2e-aa71-618e603d9b2a_1138x450.png 424w, https://substackcdn.com/image/fetch/$s_!myqg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538cffba-6d07-4b2e-aa71-618e603d9b2a_1138x450.png 848w, https://substackcdn.com/image/fetch/$s_!myqg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538cffba-6d07-4b2e-aa71-618e603d9b2a_1138x450.png 1272w, https://substackcdn.com/image/fetch/$s_!myqg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538cffba-6d07-4b2e-aa71-618e603d9b2a_1138x450.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!myqg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538cffba-6d07-4b2e-aa71-618e603d9b2a_1138x450.png" width="1138" height="450" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/538cffba-6d07-4b2e-aa71-618e603d9b2a_1138x450.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:450,&quot;width&quot;:1138,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:139605,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/164561903?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538cffba-6d07-4b2e-aa71-618e603d9b2a_1138x450.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!myqg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538cffba-6d07-4b2e-aa71-618e603d9b2a_1138x450.png 424w, https://substackcdn.com/image/fetch/$s_!myqg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538cffba-6d07-4b2e-aa71-618e603d9b2a_1138x450.png 848w, https://substackcdn.com/image/fetch/$s_!myqg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538cffba-6d07-4b2e-aa71-618e603d9b2a_1138x450.png 1272w, https://substackcdn.com/image/fetch/$s_!myqg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538cffba-6d07-4b2e-aa71-618e603d9b2a_1138x450.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>And here are a few more:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IJB_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb604f231-dc72-40e8-8c2a-6dc9271f5d5a_2606x1104.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IJB_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb604f231-dc72-40e8-8c2a-6dc9271f5d5a_2606x1104.png 424w, https://substackcdn.com/image/fetch/$s_!IJB_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb604f231-dc72-40e8-8c2a-6dc9271f5d5a_2606x1104.png 848w, https://substackcdn.com/image/fetch/$s_!IJB_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb604f231-dc72-40e8-8c2a-6dc9271f5d5a_2606x1104.png 1272w, https://substackcdn.com/image/fetch/$s_!IJB_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb604f231-dc72-40e8-8c2a-6dc9271f5d5a_2606x1104.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IJB_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb604f231-dc72-40e8-8c2a-6dc9271f5d5a_2606x1104.png" width="1456" height="617" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b604f231-dc72-40e8-8c2a-6dc9271f5d5a_2606x1104.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:617,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:131230,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/164561903?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb604f231-dc72-40e8-8c2a-6dc9271f5d5a_2606x1104.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IJB_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb604f231-dc72-40e8-8c2a-6dc9271f5d5a_2606x1104.png 424w, https://substackcdn.com/image/fetch/$s_!IJB_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb604f231-dc72-40e8-8c2a-6dc9271f5d5a_2606x1104.png 848w, https://substackcdn.com/image/fetch/$s_!IJB_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb604f231-dc72-40e8-8c2a-6dc9271f5d5a_2606x1104.png 1272w, https://substackcdn.com/image/fetch/$s_!IJB_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb604f231-dc72-40e8-8c2a-6dc9271f5d5a_2606x1104.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ol><li><p>Get the day of week from the <code>subscription_date</code></p></li><li><p>Get the mail provider</p></li><li><p>Get the number of days since the user opened the last mail</p></li></ol><p>The data Substack provides is meh, but with a bit of feature engineering, we can level it up.</p>]]></content:encoded></item><item><title><![CDATA[How to anonymize data]]></title><description><![CDATA[I&#8217;m working on a project where I need to anonymize data.]]></description><link>https://datagroundup.com/p/how-to-anonymize-data</link><guid isPermaLink="false">https://datagroundup.com/p/how-to-anonymize-data</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Tue, 20 May 2025 12:02:58 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/4ab7d6c7-8544-4909-817a-e5e437a9a56c_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I&#8217;m working on a project where I need to anonymize data. I have no experience in it, so let&#8217;s learn about it together:</p><h3>Identifiability spectrum</h3><p>When we anonymize data, we want it to be different from the original format, so it is not easy to recognize or identify. But it has levels. Some anonymization techniques will only make it harder to recognize the original data, while others make it impossible.</p><p>For example, if you know the stock ticker of a company is &#8216;GOOGL&#8217;, then you know that we talk about Google (or in this case, the company behind it: Alphabet Inc.). This ticker is a direct ID.</p><p>Indirect IDs are like the CEOs of a company. If you know only the fact that Elon Musk is the CEO of the company, then you need another identifier to limit the companies to one.</p><p>As you move further down on this spectrum, you will find it harder and harder to get back to the original data, and at the end, we have totally anonymized data that we cannot identify.</p><h3>Other aspects to consider</h3><p>Identifiability is probably the most important aspect in anonymization (btw, typing this word kills me&#8230;), but other things we should consider:</p><ul><li><p>Data should be analyzable</p></li><li><p>Reversibility</p></li><li><p>Live or static</p></li><li><p>Deterministic or nondeterministic</p></li></ul><p>When we anonymize data, we don&#8217;t want to lose the ability to analyze it. For example, if a dataset has correlation in it, then we cannot randomly change the data and lose its statistical features.</p><p>For internal use, you probably want the anonymization to be reversible. But for external parties, you usually must make the data unidentifiable, so end users cannot reverse it back to the original format.</p><p>Live anonymization is when you are not changing the entire data, only the subset that you want to access at a time. For static anonymization, data is already stored in the anonym format.</p><p>And finally, a deterministic method is where A is always changed to B. In a nondeterministic method, A can be B in the first run, but C in the second run.</p><p>Now that we know about the aspects to consider, let&#8217;s see the techniques we can use.</p><h3>Generalization</h3><p>When we generalize, we replace a value with a less specific but consistent value.</p><p>For numbers, you can use ranges, and for categorical data, you can use a broader category:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PaAV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6bcf6cc-ed88-43e7-a366-22d01f21815f_352x166.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PaAV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6bcf6cc-ed88-43e7-a366-22d01f21815f_352x166.png 424w, https://substackcdn.com/image/fetch/$s_!PaAV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6bcf6cc-ed88-43e7-a366-22d01f21815f_352x166.png 848w, https://substackcdn.com/image/fetch/$s_!PaAV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6bcf6cc-ed88-43e7-a366-22d01f21815f_352x166.png 1272w, https://substackcdn.com/image/fetch/$s_!PaAV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6bcf6cc-ed88-43e7-a366-22d01f21815f_352x166.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PaAV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6bcf6cc-ed88-43e7-a366-22d01f21815f_352x166.png" width="352" height="166" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c6bcf6cc-ed88-43e7-a366-22d01f21815f_352x166.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:166,&quot;width&quot;:352,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:9089,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/163904449?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6bcf6cc-ed88-43e7-a366-22d01f21815f_352x166.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PaAV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6bcf6cc-ed88-43e7-a366-22d01f21815f_352x166.png 424w, https://substackcdn.com/image/fetch/$s_!PaAV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6bcf6cc-ed88-43e7-a366-22d01f21815f_352x166.png 848w, https://substackcdn.com/image/fetch/$s_!PaAV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6bcf6cc-ed88-43e7-a366-22d01f21815f_352x166.png 1272w, https://substackcdn.com/image/fetch/$s_!PaAV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6bcf6cc-ed88-43e7-a366-22d01f21815f_352x166.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!efnR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1260a2f4-c18c-460f-94cc-5f08ccc2272a_266x166.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!efnR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1260a2f4-c18c-460f-94cc-5f08ccc2272a_266x166.png 424w, https://substackcdn.com/image/fetch/$s_!efnR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1260a2f4-c18c-460f-94cc-5f08ccc2272a_266x166.png 848w, https://substackcdn.com/image/fetch/$s_!efnR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1260a2f4-c18c-460f-94cc-5f08ccc2272a_266x166.png 1272w, https://substackcdn.com/image/fetch/$s_!efnR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1260a2f4-c18c-460f-94cc-5f08ccc2272a_266x166.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!efnR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1260a2f4-c18c-460f-94cc-5f08ccc2272a_266x166.png" width="266" height="166" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1260a2f4-c18c-460f-94cc-5f08ccc2272a_266x166.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:166,&quot;width&quot;:266,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:8537,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/163904449?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1260a2f4-c18c-460f-94cc-5f08ccc2272a_266x166.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!efnR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1260a2f4-c18c-460f-94cc-5f08ccc2272a_266x166.png 424w, https://substackcdn.com/image/fetch/$s_!efnR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1260a2f4-c18c-460f-94cc-5f08ccc2272a_266x166.png 848w, https://substackcdn.com/image/fetch/$s_!efnR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1260a2f4-c18c-460f-94cc-5f08ccc2272a_266x166.png 1272w, https://substackcdn.com/image/fetch/$s_!efnR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1260a2f4-c18c-460f-94cc-5f08ccc2272a_266x166.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>You can also level them:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LzsF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad021617-10ff-4a7f-b7ce-0fe90e11a0e8_890x166.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LzsF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad021617-10ff-4a7f-b7ce-0fe90e11a0e8_890x166.png 424w, https://substackcdn.com/image/fetch/$s_!LzsF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad021617-10ff-4a7f-b7ce-0fe90e11a0e8_890x166.png 848w, https://substackcdn.com/image/fetch/$s_!LzsF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad021617-10ff-4a7f-b7ce-0fe90e11a0e8_890x166.png 1272w, https://substackcdn.com/image/fetch/$s_!LzsF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad021617-10ff-4a7f-b7ce-0fe90e11a0e8_890x166.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LzsF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad021617-10ff-4a7f-b7ce-0fe90e11a0e8_890x166.png" width="890" height="166" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ad021617-10ff-4a7f-b7ce-0fe90e11a0e8_890x166.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:166,&quot;width&quot;:890,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:16933,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/163904449?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad021617-10ff-4a7f-b7ce-0fe90e11a0e8_890x166.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LzsF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad021617-10ff-4a7f-b7ce-0fe90e11a0e8_890x166.png 424w, https://substackcdn.com/image/fetch/$s_!LzsF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad021617-10ff-4a7f-b7ce-0fe90e11a0e8_890x166.png 848w, https://substackcdn.com/image/fetch/$s_!LzsF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad021617-10ff-4a7f-b7ce-0fe90e11a0e8_890x166.png 1272w, https://substackcdn.com/image/fetch/$s_!LzsF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad021617-10ff-4a7f-b7ce-0fe90e11a0e8_890x166.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><h3>Suppression</h3><p>In this technique, we make the data invisible. We either remove it or keep it, but hide it.</p><p>If we extend the example above and add gender to the table:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ca8m!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26e5900d-9e63-49c6-828e-c8b20e1e9ade_418x166.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ca8m!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26e5900d-9e63-49c6-828e-c8b20e1e9ade_418x166.png 424w, https://substackcdn.com/image/fetch/$s_!ca8m!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26e5900d-9e63-49c6-828e-c8b20e1e9ade_418x166.png 848w, https://substackcdn.com/image/fetch/$s_!ca8m!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26e5900d-9e63-49c6-828e-c8b20e1e9ade_418x166.png 1272w, https://substackcdn.com/image/fetch/$s_!ca8m!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26e5900d-9e63-49c6-828e-c8b20e1e9ade_418x166.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ca8m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26e5900d-9e63-49c6-828e-c8b20e1e9ade_418x166.png" width="418" height="166" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/26e5900d-9e63-49c6-828e-c8b20e1e9ade_418x166.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:166,&quot;width&quot;:418,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11268,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/163904449?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26e5900d-9e63-49c6-828e-c8b20e1e9ade_418x166.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ca8m!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26e5900d-9e63-49c6-828e-c8b20e1e9ade_418x166.png 424w, https://substackcdn.com/image/fetch/$s_!ca8m!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26e5900d-9e63-49c6-828e-c8b20e1e9ade_418x166.png 848w, https://substackcdn.com/image/fetch/$s_!ca8m!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26e5900d-9e63-49c6-828e-c8b20e1e9ade_418x166.png 1272w, https://substackcdn.com/image/fetch/$s_!ca8m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26e5900d-9e63-49c6-828e-c8b20e1e9ade_418x166.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>And then we suppress the gender column, we get this:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wFEW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99480e5-2dfa-43b1-ad6f-fe62f9a536b0_418x166.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wFEW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99480e5-2dfa-43b1-ad6f-fe62f9a536b0_418x166.png 424w, https://substackcdn.com/image/fetch/$s_!wFEW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99480e5-2dfa-43b1-ad6f-fe62f9a536b0_418x166.png 848w, https://substackcdn.com/image/fetch/$s_!wFEW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99480e5-2dfa-43b1-ad6f-fe62f9a536b0_418x166.png 1272w, https://substackcdn.com/image/fetch/$s_!wFEW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99480e5-2dfa-43b1-ad6f-fe62f9a536b0_418x166.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wFEW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99480e5-2dfa-43b1-ad6f-fe62f9a536b0_418x166.png" width="418" height="166" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a99480e5-2dfa-43b1-ad6f-fe62f9a536b0_418x166.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:166,&quot;width&quot;:418,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10316,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/163904449?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99480e5-2dfa-43b1-ad6f-fe62f9a536b0_418x166.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wFEW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99480e5-2dfa-43b1-ad6f-fe62f9a536b0_418x166.png 424w, https://substackcdn.com/image/fetch/$s_!wFEW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99480e5-2dfa-43b1-ad6f-fe62f9a536b0_418x166.png 848w, https://substackcdn.com/image/fetch/$s_!wFEW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99480e5-2dfa-43b1-ad6f-fe62f9a536b0_418x166.png 1272w, https://substackcdn.com/image/fetch/$s_!wFEW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99480e5-2dfa-43b1-ad6f-fe62f9a536b0_418x166.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>You can apply all these techniques conditionally or combined with other techniques.</p><h3>Distortion</h3><p>We use this technique mainly with numerical data. The original data is distorted by noise. For example, we can add a random number to each value. The formula to use can be super simple, but complicated as well.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3jNP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897281ba-1fbf-4a1f-a12b-5c28080f5838_866x166.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3jNP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897281ba-1fbf-4a1f-a12b-5c28080f5838_866x166.png 424w, https://substackcdn.com/image/fetch/$s_!3jNP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897281ba-1fbf-4a1f-a12b-5c28080f5838_866x166.png 848w, https://substackcdn.com/image/fetch/$s_!3jNP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897281ba-1fbf-4a1f-a12b-5c28080f5838_866x166.png 1272w, https://substackcdn.com/image/fetch/$s_!3jNP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897281ba-1fbf-4a1f-a12b-5c28080f5838_866x166.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3jNP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897281ba-1fbf-4a1f-a12b-5c28080f5838_866x166.png" width="866" height="166" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/897281ba-1fbf-4a1f-a12b-5c28080f5838_866x166.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:166,&quot;width&quot;:866,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:17979,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/163904449?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897281ba-1fbf-4a1f-a12b-5c28080f5838_866x166.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3jNP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897281ba-1fbf-4a1f-a12b-5c28080f5838_866x166.png 424w, https://substackcdn.com/image/fetch/$s_!3jNP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897281ba-1fbf-4a1f-a12b-5c28080f5838_866x166.png 848w, https://substackcdn.com/image/fetch/$s_!3jNP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897281ba-1fbf-4a1f-a12b-5c28080f5838_866x166.png 1272w, https://substackcdn.com/image/fetch/$s_!3jNP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897281ba-1fbf-4a1f-a12b-5c28080f5838_866x166.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>We would need to remove the <code>Original Salary</code> column, but I left it here for easier understanding.</p><p>If we want to keep the option to analyse the data, the distorted values must be plausible.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!uoKE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d21e1c-e043-4533-82c1-17045b497126_866x166.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uoKE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d21e1c-e043-4533-82c1-17045b497126_866x166.png 424w, https://substackcdn.com/image/fetch/$s_!uoKE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d21e1c-e043-4533-82c1-17045b497126_866x166.png 848w, https://substackcdn.com/image/fetch/$s_!uoKE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d21e1c-e043-4533-82c1-17045b497126_866x166.png 1272w, https://substackcdn.com/image/fetch/$s_!uoKE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d21e1c-e043-4533-82c1-17045b497126_866x166.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!uoKE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d21e1c-e043-4533-82c1-17045b497126_866x166.png" width="866" height="166" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/76d21e1c-e043-4533-82c1-17045b497126_866x166.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:166,&quot;width&quot;:866,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:18452,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/163904449?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d21e1c-e043-4533-82c1-17045b497126_866x166.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uoKE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d21e1c-e043-4533-82c1-17045b497126_866x166.png 424w, https://substackcdn.com/image/fetch/$s_!uoKE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d21e1c-e043-4533-82c1-17045b497126_866x166.png 848w, https://substackcdn.com/image/fetch/$s_!uoKE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d21e1c-e043-4533-82c1-17045b497126_866x166.png 1272w, https://substackcdn.com/image/fetch/$s_!uoKE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F76d21e1c-e043-4533-82c1-17045b497126_866x166.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>The above table applies a bad distortion and makes the salary implausible.</p><p>The salary can&#8217;t be negative, the Nurse and Cardiologist salaries are unrealistic, so an analysis of these data would be misleading.</p><h3>Swapping</h3><p>In swapping, we simply change the values between records:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CmOq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab06da6c-575f-40e5-912a-f46ebe86515c_492x166.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CmOq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab06da6c-575f-40e5-912a-f46ebe86515c_492x166.png 424w, https://substackcdn.com/image/fetch/$s_!CmOq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab06da6c-575f-40e5-912a-f46ebe86515c_492x166.png 848w, https://substackcdn.com/image/fetch/$s_!CmOq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab06da6c-575f-40e5-912a-f46ebe86515c_492x166.png 1272w, https://substackcdn.com/image/fetch/$s_!CmOq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab06da6c-575f-40e5-912a-f46ebe86515c_492x166.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CmOq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab06da6c-575f-40e5-912a-f46ebe86515c_492x166.png" width="492" height="166" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ab06da6c-575f-40e5-912a-f46ebe86515c_492x166.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:166,&quot;width&quot;:492,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:13124,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/163904449?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab06da6c-575f-40e5-912a-f46ebe86515c_492x166.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CmOq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab06da6c-575f-40e5-912a-f46ebe86515c_492x166.png 424w, https://substackcdn.com/image/fetch/$s_!CmOq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab06da6c-575f-40e5-912a-f46ebe86515c_492x166.png 848w, https://substackcdn.com/image/fetch/$s_!CmOq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab06da6c-575f-40e5-912a-f46ebe86515c_492x166.png 1272w, https://substackcdn.com/image/fetch/$s_!CmOq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab06da6c-575f-40e5-912a-f46ebe86515c_492x166.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fd_G!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa32cb609-e695-4e94-975a-1ed43660335d_492x166.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fd_G!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa32cb609-e695-4e94-975a-1ed43660335d_492x166.png 424w, https://substackcdn.com/image/fetch/$s_!fd_G!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa32cb609-e695-4e94-975a-1ed43660335d_492x166.png 848w, https://substackcdn.com/image/fetch/$s_!fd_G!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa32cb609-e695-4e94-975a-1ed43660335d_492x166.png 1272w, https://substackcdn.com/image/fetch/$s_!fd_G!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa32cb609-e695-4e94-975a-1ed43660335d_492x166.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fd_G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa32cb609-e695-4e94-975a-1ed43660335d_492x166.png" width="492" height="166" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a32cb609-e695-4e94-975a-1ed43660335d_492x166.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:166,&quot;width&quot;:492,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:13144,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/163904449?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa32cb609-e695-4e94-975a-1ed43660335d_492x166.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fd_G!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa32cb609-e695-4e94-975a-1ed43660335d_492x166.png 424w, https://substackcdn.com/image/fetch/$s_!fd_G!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa32cb609-e695-4e94-975a-1ed43660335d_492x166.png 848w, https://substackcdn.com/image/fetch/$s_!fd_G!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa32cb609-e695-4e94-975a-1ed43660335d_492x166.png 1272w, https://substackcdn.com/image/fetch/$s_!fd_G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa32cb609-e695-4e94-975a-1ed43660335d_492x166.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>The goal is to make the sensitive value unlinkable to the individual. Swapping must be controlled, because the data can be misleading again if we make it randomly.</p><p>It is more useful for homogeneous groups. Like within a category, you can more easily swap the subcategory.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!k03M!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F338632a1-4e18-4be4-9f00-b98e7ffbae8e_740x206.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!k03M!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F338632a1-4e18-4be4-9f00-b98e7ffbae8e_740x206.png 424w, https://substackcdn.com/image/fetch/$s_!k03M!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F338632a1-4e18-4be4-9f00-b98e7ffbae8e_740x206.png 848w, https://substackcdn.com/image/fetch/$s_!k03M!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F338632a1-4e18-4be4-9f00-b98e7ffbae8e_740x206.png 1272w, https://substackcdn.com/image/fetch/$s_!k03M!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F338632a1-4e18-4be4-9f00-b98e7ffbae8e_740x206.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!k03M!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F338632a1-4e18-4be4-9f00-b98e7ffbae8e_740x206.png" width="740" height="206" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/338632a1-4e18-4be4-9f00-b98e7ffbae8e_740x206.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:206,&quot;width&quot;:740,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:17915,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/163904449?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F338632a1-4e18-4be4-9f00-b98e7ffbae8e_740x206.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!k03M!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F338632a1-4e18-4be4-9f00-b98e7ffbae8e_740x206.png 424w, https://substackcdn.com/image/fetch/$s_!k03M!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F338632a1-4e18-4be4-9f00-b98e7ffbae8e_740x206.png 848w, https://substackcdn.com/image/fetch/$s_!k03M!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F338632a1-4e18-4be4-9f00-b98e7ffbae8e_740x206.png 1272w, https://substackcdn.com/image/fetch/$s_!k03M!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F338632a1-4e18-4be4-9f00-b98e7ffbae8e_740x206.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Pvem!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d2c04f-741c-4332-b88c-7f0b0b703c1c_740x206.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Pvem!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d2c04f-741c-4332-b88c-7f0b0b703c1c_740x206.png 424w, https://substackcdn.com/image/fetch/$s_!Pvem!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d2c04f-741c-4332-b88c-7f0b0b703c1c_740x206.png 848w, https://substackcdn.com/image/fetch/$s_!Pvem!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d2c04f-741c-4332-b88c-7f0b0b703c1c_740x206.png 1272w, https://substackcdn.com/image/fetch/$s_!Pvem!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d2c04f-741c-4332-b88c-7f0b0b703c1c_740x206.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Pvem!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d2c04f-741c-4332-b88c-7f0b0b703c1c_740x206.png" width="740" height="206" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/47d2c04f-741c-4332-b88c-7f0b0b703c1c_740x206.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:206,&quot;width&quot;:740,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:18153,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/163904449?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d2c04f-741c-4332-b88c-7f0b0b703c1c_740x206.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Pvem!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d2c04f-741c-4332-b88c-7f0b0b703c1c_740x206.png 424w, https://substackcdn.com/image/fetch/$s_!Pvem!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d2c04f-741c-4332-b88c-7f0b0b703c1c_740x206.png 848w, https://substackcdn.com/image/fetch/$s_!Pvem!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d2c04f-741c-4332-b88c-7f0b0b703c1c_740x206.png 1272w, https://substackcdn.com/image/fetch/$s_!Pvem!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F47d2c04f-741c-4332-b88c-7f0b0b703c1c_740x206.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Now we cannot link the person to the original job, but the context is still logical.</p><h3>Masking</h3><p>Masking replaces part of a data value with a placeholder but keeps the format:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8sHI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd2fb187-e9b0-4cae-a530-2548bf1eb23b_884x124.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8sHI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd2fb187-e9b0-4cae-a530-2548bf1eb23b_884x124.png 424w, https://substackcdn.com/image/fetch/$s_!8sHI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd2fb187-e9b0-4cae-a530-2548bf1eb23b_884x124.png 848w, https://substackcdn.com/image/fetch/$s_!8sHI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd2fb187-e9b0-4cae-a530-2548bf1eb23b_884x124.png 1272w, https://substackcdn.com/image/fetch/$s_!8sHI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd2fb187-e9b0-4cae-a530-2548bf1eb23b_884x124.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8sHI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd2fb187-e9b0-4cae-a530-2548bf1eb23b_884x124.png" width="884" height="124" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bd2fb187-e9b0-4cae-a530-2548bf1eb23b_884x124.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:124,&quot;width&quot;:884,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:13772,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/163904449?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd2fb187-e9b0-4cae-a530-2548bf1eb23b_884x124.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8sHI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd2fb187-e9b0-4cae-a530-2548bf1eb23b_884x124.png 424w, https://substackcdn.com/image/fetch/$s_!8sHI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd2fb187-e9b0-4cae-a530-2548bf1eb23b_884x124.png 848w, https://substackcdn.com/image/fetch/$s_!8sHI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd2fb187-e9b0-4cae-a530-2548bf1eb23b_884x124.png 1272w, https://substackcdn.com/image/fetch/$s_!8sHI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd2fb187-e9b0-4cae-a530-2548bf1eb23b_884x124.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>It is great if we want to keep the pattern recognizable, so the readability stays in the data.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Data Ground Up! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><p>It is a super broad  and really interesting topic. We just scratched the surface, but I might go deeper into it later. See you there as well.</p><p></p>]]></content:encoded></item><item><title><![CDATA[5 Daily Habits to Become Better at Data]]></title><description><![CDATA[Spend 5 minutes on these daily and your career will skyrocket!]]></description><link>https://datagroundup.com/p/5-daily-habits-to-become-better-at</link><guid isPermaLink="false">https://datagroundup.com/p/5-daily-habits-to-become-better-at</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Thu, 10 Apr 2025 12:02:07 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/abb532e9-1b48-4d57-9fef-eb5e85eec162_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>1. Read documentation</h2><p>Reading documentation is a skill. If you are early in your career, this habit will help you build your documentation reading muscles.</p><p>If you are more experienced and think you know a lot, I would still suggest doing this regularly. Every time I reread the documentation for a Python topic or DAX formula, I find something new. You will not learn the nuances in the first few reads.</p><p>Consider the <code>read_csv</code> method in pandas:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PyvM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49f4f8c3-c169-407b-acec-7c83876f6cf1_1483x824.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PyvM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49f4f8c3-c169-407b-acec-7c83876f6cf1_1483x824.png 424w, https://substackcdn.com/image/fetch/$s_!PyvM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49f4f8c3-c169-407b-acec-7c83876f6cf1_1483x824.png 848w, https://substackcdn.com/image/fetch/$s_!PyvM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49f4f8c3-c169-407b-acec-7c83876f6cf1_1483x824.png 1272w, https://substackcdn.com/image/fetch/$s_!PyvM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49f4f8c3-c169-407b-acec-7c83876f6cf1_1483x824.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PyvM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49f4f8c3-c169-407b-acec-7c83876f6cf1_1483x824.png" width="1456" height="809" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/49f4f8c3-c169-407b-acec-7c83876f6cf1_1483x824.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:809,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:174590,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/160997087?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49f4f8c3-c169-407b-acec-7c83876f6cf1_1483x824.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PyvM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49f4f8c3-c169-407b-acec-7c83876f6cf1_1483x824.png 424w, https://substackcdn.com/image/fetch/$s_!PyvM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49f4f8c3-c169-407b-acec-7c83876f6cf1_1483x824.png 848w, https://substackcdn.com/image/fetch/$s_!PyvM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49f4f8c3-c169-407b-acec-7c83876f6cf1_1483x824.png 1272w, https://substackcdn.com/image/fetch/$s_!PyvM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49f4f8c3-c169-407b-acec-7c83876f6cf1_1483x824.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>It has many parameters, and people usually use it only to load in the data, but you can start your data prep with it. To understand it well, you need to come back a few times.</p><p><strong>Plus point:</strong> Think about how you could use the new knowledge in your current project.</p><p><strong>Plus 2 points:</strong> Ask ChatGPT to give you some problems and practice the new knowledge, or implement it in your current project.</p><h2>2. Review a chart</h2><p>The media is full of visualizations nowadays. When you see one, don&#8217;t just look at it as a regular person. Look at it from the data and visualization perspective.</p><p>Ask: <em>What works? What doesn&#8217;t? How would I improve it? Why did they choose this chart type? Why this color?</em></p><p>You can use the r/dataisbeautiful subreddit for this exercise. You know what? Let&#8217;s do one together.</p><p>Here is the first chart that comes up for me at the moment on the subreddit:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HgBl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1413942-9896-4d24-8bc3-a1b4d0f84bdb_1600x1587.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HgBl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1413942-9896-4d24-8bc3-a1b4d0f84bdb_1600x1587.png 424w, https://substackcdn.com/image/fetch/$s_!HgBl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1413942-9896-4d24-8bc3-a1b4d0f84bdb_1600x1587.png 848w, https://substackcdn.com/image/fetch/$s_!HgBl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1413942-9896-4d24-8bc3-a1b4d0f84bdb_1600x1587.png 1272w, https://substackcdn.com/image/fetch/$s_!HgBl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1413942-9896-4d24-8bc3-a1b4d0f84bdb_1600x1587.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HgBl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1413942-9896-4d24-8bc3-a1b4d0f84bdb_1600x1587.png" width="1456" height="1444" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a1413942-9896-4d24-8bc3-a1b4d0f84bdb_1600x1587.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1444,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:649904,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/160997087?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1413942-9896-4d24-8bc3-a1b4d0f84bdb_1600x1587.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HgBl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1413942-9896-4d24-8bc3-a1b4d0f84bdb_1600x1587.png 424w, https://substackcdn.com/image/fetch/$s_!HgBl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1413942-9896-4d24-8bc3-a1b4d0f84bdb_1600x1587.png 848w, https://substackcdn.com/image/fetch/$s_!HgBl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1413942-9896-4d24-8bc3-a1b4d0f84bdb_1600x1587.png 1272w, https://substackcdn.com/image/fetch/$s_!HgBl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1413942-9896-4d24-8bc3-a1b4d0f84bdb_1600x1587.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><a href="https://www.reddit.com/r/dataisbeautiful/comments/1jv43ei/oc_us_balance_of_trade/">https://www.reddit.com/r/dataisbeautiful/comments/1jv43ei/oc_us_balance_of_trade/</a></p><p>And here are my quick, unfiltered, thinking-loud thoughts about it:</p><p>" The title and subtitle are short, but enough for the story. The labels are clear, but the shades of colors might be too close to each other. Bigger contrast may be better - I am not sure about their color blindness score either, but they fit the background well. The Axes are clear, the distance is consistent - They don&#8217;t want to lie or form the narrative with axes manipulation. The stacked bar chart helps to see the net effect. Long enough timeframe to see the trend. The data source is also added. Straight to the point, no fluff, can build a great story around it. 10/10"</p><p><strong>Plus 2 points:</strong> Try to recreate the chart.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Data Ground Up! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h2>3. Read articles/newsletters or watch videos</h2><p>This doesn&#8217;t require any description. Watch tutorials or read posts about the tools you use or general data topics, but don&#8217;t stop there.</p><p>Sometimes, take a rest from data and learn about other relevant things like communication, presentation, business knowledge, or other soft skills that are still necessary in the field.</p><p><strong>Plus point:</strong> Share them with friends and colleagues - Learn together</p><p><strong>Plus 2 points:</strong> Create summaries, write notes, and share them online (see 5. point).</p><p>If we talk about business knowledge &#128071;</p><h2>4. Translate a Business Question into Data Terms</h2><p>The difference between good and excellent data professionals is the impact they make. To be impactful, you need to know the connection between business and data. This practice will help to improve here.</p><p>Take a hypothetical business question like <em>Why are sales down in Q2?</em> or <em>Which customers are likely to churn?</em> and ask: <em>What data would I need? What metrics would I use?</em></p><div class="comment" data-attrs="{&quot;url&quot;:&quot;https://open.substack.com/home&quot;,&quot;commentId&quot;:104733610,&quot;comment&quot;:{&quot;id&quot;:104733610,&quot;date&quot;:&quot;2025-03-31T06:01:26.862Z&quot;,&quot;edited_at&quot;:&quot;2025-03-31T09:59:25.671Z&quot;,&quot;body&quot;:&quot;Most junior data scientists obsess over Python libraries and ML techniques. \n\nThe ones who advance quickly obsess over solving actual problems, I learned this the hard way.&quot;,&quot;body_json&quot;:{&quot;type&quot;:&quot;doc&quot;,&quot;attrs&quot;:{&quot;schemaVersion&quot;:&quot;v1&quot;},&quot;content&quot;:[{&quot;type&quot;:&quot;paragraph&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;marks&quot;:[{&quot;type&quot;:&quot;bold&quot;}],&quot;text&quot;:&quot;Most junior data scientists obsess over Python libraries and ML techniques. &quot;}]},{&quot;type&quot;:&quot;paragraph&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;The ones who advance quickly obsess over solving actual problems, I learned this the hard way.&quot;}]}]},&quot;restacks&quot;:5,&quot;reaction_count&quot;:32,&quot;attachments&quot;:[],&quot;name&quot;:&quot;Andres Vourakis&quot;,&quot;user_id&quot;:135808578,&quot;photo_url&quot;:&quot;https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9ebf6fc-4ed6-47e1-938e-a1fa37a2347e_1601x1646.jpeg&quot;,&quot;user_bestseller_tier&quot;:null}}" data-component-name="CommentPlaceholder"></div><p><strong>Plus point:</strong> Document these business-to-data translations so you can use them as &#8220;templates&#8221;. If a similar question pops up, you just need to pull them from your pocket, and no need to start from zero.</p><h2>5. Write a Data Journal</h2><p>I started writing to learn. Writing on X and on Substack helped me a lot throughout my career.</p><p>Writing will help you build technical skills. You need to do research, create code snippets, go deep into topics, etc., to have a quality output.</p><p>It will also help with soft skills like presentation and clear communication. Framing your ideas effectively is something that&#8217;s really hard to master, but writing will improve it for you unnoticeably.</p><p>Another advantage is the community aspect. Writing made it possible for me to talk to awesome data experts and call them friends. From a random person, you can elevate yourself to the next shelf, and other creators will look at you differently.</p><p><strong>Plus point:</strong> If you already have a blog or something, share with us!</p><h2>Final thoughts</h2><p>Spend 5 minutes on each of the above exercises every day (or a few times a week) and your career will skyrocket! Short but focused practices can add up in the long run. Of course, if you go for plus points, it can take a lot more time, but it&#8217;s an investment.</p><p>Do you have a data habit that you do daily? Let us know in the comments.</p>]]></content:encoded></item><item><title><![CDATA[The Best Thing I Ever Did]]></title><description><![CDATA[My story about how I got into Data]]></description><link>https://datagroundup.com/p/the-best-thing-i-ever-did</link><guid isPermaLink="false">https://datagroundup.com/p/the-best-thing-i-ever-did</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Mon, 07 Apr 2025 12:03:52 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/d207bf7f-3637-41a2-9b72-9f2d01ea6d24_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In 2019, I started to work as an intern at a telecom company. It was a boring 9-5 job with some general Excel tasks. At that time, I was not an Excel expert. We had an Excel course at the university, so at least I knew VLOOKUP. But that was it. I started to learn the relevant keyboard shortcuts, and I got faster.</p><p>After the short internship, I got a full-time position in the team. I did the same boring shit, but for more money. Then Covid hit, and I became a zombie staring at Excel sheets for a few hours a day from home office. I hated it, and I wanted something more exciting.</p><p>&#8220;There must be a better way to do all this.&#8221; I thought, and luckily, the company organized a VBA training internally. &#8220;Ohh, this will be a better way.&#8221; I realized after I googled what the hell VBA is.</p><p><strong>I enrolled in the course, and that was the best thing I ever did!</strong></p><p>We had 4 sessions about the very basics. Variables, Loops, Functions. It was a programming 101 with VBA. It got me hooked. At the end of the course, we got a script that was able to send automated emails. It felt magical.</p><p>For the final project, I automated one of my tasks, saving me 1 hour every week. It was super simple, but I knew that this was something I needed to dig deeper into.</p><p>Programming was different back then. We didn&#8217;t have ChatGPT, so I learned VBA the OG way. Googling every single line and spending hours on Stack Overflow. It was painful, but I had a mission to automate all my tasks at least partially. And I did. The more I automated, the more I could spend on learning, and the more I learned, the more I automated.</p><p>In 6 months, I maxed out the options I had, so I started to look for something more challenging. A Data Analyst role opened internally. It required some BI skills and SQL proficiency. I had none of those, but I still applied.</p><p>In the interview, I presented my VBA projects. It showed how passionate I was and my ability to learn. They told me that if in the next few weeks I get decent with SQL, I will get the job.</p><p>Projects, 100/10, would recommend and must-haves. You may have a lot of badges on your CV from 1&#8211;2 hours Udemy courses, but can you speak about a project you worked on and solved real-world problems? I did not have the SQL badges from Udemy yet, but I solved problems before. No matter which career path you choose, work on some projects!</p><p>I bought a <a href="https://www.udemy.com/course/the-ultimate-mysql-bootcamp-go-from-sql-beginner-to-expert/">SQL course from Udemy</a>. and spent 3&#8211;4 hours a day to learn it. I felt the spark with SQL again. I got the job. Maybe the little cute cat helped to stay on the course.</p><p>It was a beginner-friendly role, but I learned a lot of SQL and some basics of QLIK. That is a BI Tool that is not so popular for a reason. 2/10 would not recommend. But at least I could tell later that I had some experience with BI.</p><p>I knew that the next major step would be to learn Python. I watched some<a href="https://youtu.be/rfscVS0vtbw?si=DaUP9wMhKnIXD8hs"> courses on Youtube</a> and took notes. During my journey, I started to follow people on social media, and I heard that if you want to deeply understand something, teach it. I found some other people who did &#8220;learning in public&#8221; and I gave it a shot myself.</p><p>I studied Statistics, Pandas, Matplotlib, basics of ML, and a bunch of other topics. Sharing my journey into data also taught me communication, marketing, design, and business stuff. Blogging is another great thing I did for my career. 10/10 would recommend.</p><p>Data Analysis is not just about the data. We need to sell our work, and we need to sell ourselves on interviews, for example. In data, hard skills are overrated, and soft skills are underrated. We should spend more time on communication, sales, and storytelling skills early in our careers. Even if we are not directly working within those areas, the skills are general. You can be the most talented coder if you cannot present your results effectively.</p><p>In the meantime, I got accepted to a Swedish university, so I did my masters in Finance there. I wanted to be a Financial Data Analyst. I studied Finance at the Uni, and I studied Data online in front of more and more people.</p><p>You may ask why no data at a university? I felt that a Financial degree would be more beneficial later in my career with self-taught data knowledge. I did my niche knowledge at an institution and studied data on my own. Niche knowledge is also really important. If your niche is Biochemistry in data, then the Biochemistry part will be super hard to learn alone.</p><p>But if you want to be in Machine Learning, the path without an ML degree will be way harder.</p><p>That&#8217;s how my career and content game started, and now here we are. I am working in Risk Reporting, so I can use all the knowledge I collected throughout the last few years. I am still learning a lot of data, and I share it here.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Data Ground Up! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p><strong>To sum it up, here is my roadmap in order of learning the skill:</strong></p><p>Excel<br>VBA<br>SQL<br>BI Basics<br>Python<br>Python packages for data<br>Visualization<br>Statistics</p><p>Next on my list:</p><p>DAX (since I mainly use Power BI now)<br>Data Modeling<br>Cloud</p><p>Do I recommend others to follow this roadmap? You probably know the answer. It is always: &#8220;It depends.&#8221;</p><p>I think it has a great progression towards Analytics Engineering, where I am heading.</p><p>If you want to be a Data Analyst, it is a great path. You would learn from the ground up. VBA is not a must, but Excel knowledge can be super beneficial. Learning how to work with tabular data, how pivots work, how functions work will be useful. Then, picking up SQL, BI, and Python will set you up for a junior role.</p><p>For Data Science and Machine Learning, Math, Statistics, Linear Algebra, and similar topics should be a big part of the roadmap. These are harder skills to master, so self-taught ML Engineers are rare animals. If you want to go down this route, you should consider a degree from a great college.</p><p>They say there are no Junior Data Engineers. If this is true, being a Data Analyst is a great starting point, and then you can double down on SQL, data modeling, pipelines, and Cloud.</p>]]></content:encoded></item><item><title><![CDATA[SQL vs ORM - Just Stay With SQL!]]></title><description><![CDATA[I am a data guy.]]></description><link>https://datagroundup.com/p/sql-vs-orm-just-stay-with-sql</link><guid isPermaLink="false">https://datagroundup.com/p/sql-vs-orm-just-stay-with-sql</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Tue, 01 Apr 2025 12:04:03 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/546661dd-1bd1-4bff-9ace-ef797cdb9a91_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I am a data guy. I know how to write Python code for Matplotlib, Pandas, and some general tips and tricks.</p><p>Coming from data, I also know SQL. But I don't know anything about web frameworks or backend development, and I could go on with this list for an hour.</p><p>I realised that if I want to build data apps, I need to learn some of those things. One of the first topics that came up is ORM.</p><h3>What is an ORM?</h3><p>ORM (Object Relational Mapping) is a programming technique that lets you interact with a relational database using the objects and classes in your programming language instead of writing raw SQL.</p><p>In the ORM context, <em>classes</em> are the tables, and <em>objects</em> are the rows from the table.</p><p>Here is an example table transformed into Python objects:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0Jxx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff635e7a0-2643-420c-bde9-6094eef44716_900x351.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0Jxx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff635e7a0-2643-420c-bde9-6094eef44716_900x351.png 424w, https://substackcdn.com/image/fetch/$s_!0Jxx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff635e7a0-2643-420c-bde9-6094eef44716_900x351.png 848w, https://substackcdn.com/image/fetch/$s_!0Jxx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff635e7a0-2643-420c-bde9-6094eef44716_900x351.png 1272w, https://substackcdn.com/image/fetch/$s_!0Jxx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff635e7a0-2643-420c-bde9-6094eef44716_900x351.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0Jxx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff635e7a0-2643-420c-bde9-6094eef44716_900x351.png" width="900" height="351" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f635e7a0-2643-420c-bde9-6094eef44716_900x351.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:351,&quot;width&quot;:900,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:84353,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/157193213?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff635e7a0-2643-420c-bde9-6094eef44716_900x351.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0Jxx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff635e7a0-2643-420c-bde9-6094eef44716_900x351.png 424w, https://substackcdn.com/image/fetch/$s_!0Jxx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff635e7a0-2643-420c-bde9-6094eef44716_900x351.png 848w, https://substackcdn.com/image/fetch/$s_!0Jxx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff635e7a0-2643-420c-bde9-6094eef44716_900x351.png 1272w, https://substackcdn.com/image/fetch/$s_!0Jxx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff635e7a0-2643-420c-bde9-6094eef44716_900x351.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>There are many options for ORM in Python:</p><ol><li><p>SQLAlchemy</p></li><li><p>Peewee</p></li><li><p>The Django ORM<br>and a lot more...</p></li></ol><p>Let's see some code examples:</p><p>If we want to query the data in SQL, we would do something like this:</p><pre><code><code>SELECT * FROM users WHERE age &gt; 30;
</code></code></pre><p>The same in ORM would look like this:</p><pre><code><code>results = session.query(User).filter(User.age &gt; 30).all()
</code></code></pre><p><code>Filter</code> is our <code>Where</code> statement, <code>All</code> is the <code>*</code>, and <code>Query</code> is the <code>Select from</code>.</p><p>You can also replicate <code>group by </code>and use aggregate functions.</p><pre><code><code>SELECT AVG(age) FROM users;
</code></code></pre><p>The above SQL is equal to the below ORM:</p><pre><code><code>avg_age = session.query(func.avg(User.age)).scalar()
</code></code></pre><p>And similarly for Group by:</p><pre><code><code>SELECT age, COUNT(*) FROM users
WHERE age &gt; 25
GROUP BY age;
</code></code></pre><pre><code><code>results = session.query(User.age, func.count()) \
    .filter(User.age &gt; 25) \
    .group_by(User.age) \
    .all()
</code></code></pre><p>As you can see, we can easily achieve the same thing with pure Python code, keeping the Object Oriented look and feel.</p><p>This is the biggest advantage of ORM. You don't need to jump languages, and it makes fast and clean development possible.</p><p>Also, if the underlying database were to change, for example, from SQLite to MySQL, ORM would still work the same way.</p><p>If you are super comfortable in Python and don't know a lot about SQL, it is a great alternative, but there are disadvantages as well.</p><p>With more complex queries, the syntax can be harder to write, and the execution may slow down. That's why it's a good idea to be ready to go back to raw SQL.</p><p>When we use ORM, we shift the data manipulation into the application itself, we do not handle it separately. It's not an issue if the app design is ok, but it can be chaotic.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Data Ground Up! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h3>Conclusion</h3><p>I realised during reading and learning about ORMs that I should stay with raw SQL. I already know that well, and I am comfortable working with it.</p><p>I see the debate on the internet about which is better. Just like with everything else, there are advantages and disadvantages to both concepts. But the biggest advantage of SQL over ORM for me is that I know it already. Why would I learn the deep details of a new concept if I can easily replace it with SQL?</p><p>Coming from data, in this case, is good. On the other hand, if you are leaning towards ORMs, I would suggest to still learn SQL. ORM is great, but for complex problems, SQL will be superior. Also, the logic (and even the main syntax) is similar, so being familiar with SQL will not hurt.</p><p>The biggest conclusion for me was this:</p><blockquote><p>Every shiny new framework or tool looks good in a simplified, small example.</p><p>Don&#8217;t fall for it and try to learn everything.</p><p>Focus on battle-tested tools that have stood the test of time.</p></blockquote><p>In this case, it is SQL for me. It was great to learn the concept and basics of ORM, but it's not worth going deeper.</p>]]></content:encoded></item><item><title><![CDATA[Visualization is Marketing - 2 Questions to ask before every visualization]]></title><description><![CDATA[Who is the audience?]]></description><link>https://datagroundup.com/p/visualization-is-marketing-2-questions</link><guid isPermaLink="false">https://datagroundup.com/p/visualization-is-marketing-2-questions</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Fri, 28 Mar 2025 13:03:38 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/fe90941d-7650-41ca-99b3-5df65a179c03_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>Who is the audience?</h3><p>I will talk differently to my grandma and my manager.</p><p>Defining the audience should be the first step in every visualization project. The target audience will guide every following decision.</p><p>A visualization for the Sales team will be something about trends and revenue, while a presentation to HR should be about salary and diversity.</p><p>You may not need to break everything down to ELI5 level if the audience has a technical background.</p><p>Part of this question should be the goal of the audience. You may find the perfect language and tools for your communication, but your result will be 0 if you talk about apples when they want to hear about oranges.</p><p>So when you have a clear picture of the WHO, you need the WHAT.</p><h3>What&#8217;s the one thing I want them to remember tomorrow?</h3><p>You may feel tempted to show that you can use the latest tool to create the most colorful infographic with 50 metrics on one chart.</p><p>The result will be fancy, but not impactful. You want results that will stick with the audience, and they will leave with action items based on your presentation.</p><p>You can make strong visualizations in Excel easily. Don&#8217;t need to reinvent the wheel, keep it simple and effective.</p><p>Casey Neistat said:</p><blockquote><p>&#8220;The best steak houses serve their filet on a plate with nothing else. Shitty franchises cover theirs in sauce and other shit to distract you from the fact you&#8217;re eating dog food.&#8221;</p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ubzY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8806f1d0-6b64-4e8d-8e3b-6a5825073cbc_680x680.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ubzY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8806f1d0-6b64-4e8d-8e3b-6a5825073cbc_680x680.png 424w, https://substackcdn.com/image/fetch/$s_!ubzY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8806f1d0-6b64-4e8d-8e3b-6a5825073cbc_680x680.png 848w, https://substackcdn.com/image/fetch/$s_!ubzY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8806f1d0-6b64-4e8d-8e3b-6a5825073cbc_680x680.png 1272w, https://substackcdn.com/image/fetch/$s_!ubzY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8806f1d0-6b64-4e8d-8e3b-6a5825073cbc_680x680.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ubzY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8806f1d0-6b64-4e8d-8e3b-6a5825073cbc_680x680.png" width="680" height="680" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8806f1d0-6b64-4e8d-8e3b-6a5825073cbc_680x680.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:680,&quot;width&quot;:680,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:153957,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159809271?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8806f1d0-6b64-4e8d-8e3b-6a5825073cbc_680x680.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ubzY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8806f1d0-6b64-4e8d-8e3b-6a5825073cbc_680x680.png 424w, https://substackcdn.com/image/fetch/$s_!ubzY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8806f1d0-6b64-4e8d-8e3b-6a5825073cbc_680x680.png 848w, https://substackcdn.com/image/fetch/$s_!ubzY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8806f1d0-6b64-4e8d-8e3b-6a5825073cbc_680x680.png 1272w, https://substackcdn.com/image/fetch/$s_!ubzY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8806f1d0-6b64-4e8d-8e3b-6a5825073cbc_680x680.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><a href="https://ckarchive.com/b/lmuehmhn4337vtd7kkm78c8r5e000cg">https://ckarchive.com/b/lmuehmhn4337vtd7kkm78c8r5e000cg</a></p><p>I read the above newsletter about marketing and realized how close it is to visualization. They are about the same thing: One story that we want to sell to the audience and make it stick.</p><p>Finding that one thing may be harder than putting together the fancy visual. All those tools give you comfort, and you believe that if you put one more element on the chart, it will be better. Usually not the case.</p><p>After a point, it is not about technical skills, but domain knowledge and understanding what can drive the most impact.</p><p>The best copywriters write short but memorable lines, and the best billboards are simple:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!E_Ey!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada46775-b652-4619-b5fd-1917234424b5_1259x709.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!E_Ey!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada46775-b652-4619-b5fd-1917234424b5_1259x709.png 424w, https://substackcdn.com/image/fetch/$s_!E_Ey!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada46775-b652-4619-b5fd-1917234424b5_1259x709.png 848w, https://substackcdn.com/image/fetch/$s_!E_Ey!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada46775-b652-4619-b5fd-1917234424b5_1259x709.png 1272w, https://substackcdn.com/image/fetch/$s_!E_Ey!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada46775-b652-4619-b5fd-1917234424b5_1259x709.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!E_Ey!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada46775-b652-4619-b5fd-1917234424b5_1259x709.png" width="1259" height="709" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ada46775-b652-4619-b5fd-1917234424b5_1259x709.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:709,&quot;width&quot;:1259,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:860477,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159809271?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada46775-b652-4619-b5fd-1917234424b5_1259x709.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!E_Ey!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada46775-b652-4619-b5fd-1917234424b5_1259x709.png 424w, https://substackcdn.com/image/fetch/$s_!E_Ey!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada46775-b652-4619-b5fd-1917234424b5_1259x709.png 848w, https://substackcdn.com/image/fetch/$s_!E_Ey!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada46775-b652-4619-b5fd-1917234424b5_1259x709.png 1272w, https://substackcdn.com/image/fetch/$s_!E_Ey!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada46775-b652-4619-b5fd-1917234424b5_1259x709.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><a href="https://marketingexamples.com/ads/shot-on-iphone">https://marketingexamples.com/ads/shot-on-iphone</a></p><p>One sentence with a great picture can tell more than a bunch of facts. Translate this idea into visualization:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!H5wb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe48c6af4-c1a0-4a2f-8090-e25c0157defa_1000x423.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!H5wb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe48c6af4-c1a0-4a2f-8090-e25c0157defa_1000x423.png 424w, https://substackcdn.com/image/fetch/$s_!H5wb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe48c6af4-c1a0-4a2f-8090-e25c0157defa_1000x423.png 848w, https://substackcdn.com/image/fetch/$s_!H5wb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe48c6af4-c1a0-4a2f-8090-e25c0157defa_1000x423.png 1272w, https://substackcdn.com/image/fetch/$s_!H5wb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe48c6af4-c1a0-4a2f-8090-e25c0157defa_1000x423.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!H5wb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe48c6af4-c1a0-4a2f-8090-e25c0157defa_1000x423.png" width="1000" height="423" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e48c6af4-c1a0-4a2f-8090-e25c0157defa_1000x423.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:423,&quot;width&quot;:1000,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:151013,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159809271?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe48c6af4-c1a0-4a2f-8090-e25c0157defa_1000x423.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!H5wb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe48c6af4-c1a0-4a2f-8090-e25c0157defa_1000x423.png 424w, https://substackcdn.com/image/fetch/$s_!H5wb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe48c6af4-c1a0-4a2f-8090-e25c0157defa_1000x423.png 848w, https://substackcdn.com/image/fetch/$s_!H5wb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe48c6af4-c1a0-4a2f-8090-e25c0157defa_1000x423.png 1272w, https://substackcdn.com/image/fetch/$s_!H5wb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe48c6af4-c1a0-4a2f-8090-e25c0157defa_1000x423.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>A few more examples:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fOUf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19437375-f4b3-489f-bd2d-d9e322afb1c1_544x680.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fOUf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19437375-f4b3-489f-bd2d-d9e322afb1c1_544x680.png 424w, https://substackcdn.com/image/fetch/$s_!fOUf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19437375-f4b3-489f-bd2d-d9e322afb1c1_544x680.png 848w, https://substackcdn.com/image/fetch/$s_!fOUf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19437375-f4b3-489f-bd2d-d9e322afb1c1_544x680.png 1272w, https://substackcdn.com/image/fetch/$s_!fOUf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19437375-f4b3-489f-bd2d-d9e322afb1c1_544x680.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fOUf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19437375-f4b3-489f-bd2d-d9e322afb1c1_544x680.png" width="544" height="680" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/19437375-f4b3-489f-bd2d-d9e322afb1c1_544x680.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:680,&quot;width&quot;:544,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:127000,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159809271?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19437375-f4b3-489f-bd2d-d9e322afb1c1_544x680.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fOUf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19437375-f4b3-489f-bd2d-d9e322afb1c1_544x680.png 424w, https://substackcdn.com/image/fetch/$s_!fOUf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19437375-f4b3-489f-bd2d-d9e322afb1c1_544x680.png 848w, https://substackcdn.com/image/fetch/$s_!fOUf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19437375-f4b3-489f-bd2d-d9e322afb1c1_544x680.png 1272w, https://substackcdn.com/image/fetch/$s_!fOUf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19437375-f4b3-489f-bd2d-d9e322afb1c1_544x680.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Data Ground Up! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!P1BQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a90a0d3-dbfb-4139-ba9f-6affd051dfdd_1080x1350.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!P1BQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a90a0d3-dbfb-4139-ba9f-6affd051dfdd_1080x1350.png 424w, https://substackcdn.com/image/fetch/$s_!P1BQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a90a0d3-dbfb-4139-ba9f-6affd051dfdd_1080x1350.png 848w, https://substackcdn.com/image/fetch/$s_!P1BQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a90a0d3-dbfb-4139-ba9f-6affd051dfdd_1080x1350.png 1272w, https://substackcdn.com/image/fetch/$s_!P1BQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a90a0d3-dbfb-4139-ba9f-6affd051dfdd_1080x1350.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!P1BQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a90a0d3-dbfb-4139-ba9f-6affd051dfdd_1080x1350.png" width="1080" height="1350" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3a90a0d3-dbfb-4139-ba9f-6affd051dfdd_1080x1350.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1350,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1848580,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159809271?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a90a0d3-dbfb-4139-ba9f-6affd051dfdd_1080x1350.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!P1BQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a90a0d3-dbfb-4139-ba9f-6affd051dfdd_1080x1350.png 424w, https://substackcdn.com/image/fetch/$s_!P1BQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a90a0d3-dbfb-4139-ba9f-6affd051dfdd_1080x1350.png 848w, https://substackcdn.com/image/fetch/$s_!P1BQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a90a0d3-dbfb-4139-ba9f-6affd051dfdd_1080x1350.png 1272w, https://substackcdn.com/image/fetch/$s_!P1BQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a90a0d3-dbfb-4139-ba9f-6affd051dfdd_1080x1350.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><a href="https://x.com/The_AdProfessor/status/1876270402156310688">https://x.com/The_AdProfessor/status/1876270402156310688</a></p><p>Marketing is about persuasion. If your visuals are good, it will persuade the audience and drive good decisions.</p><p>The core principles are the same. Stay within the borders of simplicity, but still be creative!</p>]]></content:encoded></item><item><title><![CDATA[Data Lake, Warehouse, Fabric - What is the difference?]]></title><description><![CDATA[When we work with data it is really important to understand the sources.]]></description><link>https://datagroundup.com/p/data-lake-warehouse-fabric-what-is</link><guid isPermaLink="false">https://datagroundup.com/p/data-lake-warehouse-fabric-what-is</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Thu, 20 Mar 2025 13:03:54 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/d872a4c2-4b76-4ed2-9731-f222c74f3d8e_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When we work with data it is really important to understand the sources. There are many options available and I wanted to learn about them.</p><p>I found a video with James Serra, an expert in Data Architecture, and this rabbit hole is deeeeep. I scratched the surface for you, so here are my notes from the <a href="https://www.youtube.com/watch?v=rmfbbPPkgp8">video</a> and his <a href="https://www.jamesserra.com/">blog</a>:</p><h2>Data Warehouse</h2><p>We don&#8217;t want to access the data directly from its sources. These sources can be customer information, product information, or purchase data from the same system/app, but they may be in different locations. We need a copy of the data in one place, and we store this copy in the DW.</p><p><strong>The DW will be the single version of truth for historical data. We don&#8217;t want to run reports or analyses on the sources directly.</strong></p><p>A DW is optimized for reading, meaning that it is easier to pull data from it than from the source systems. The source systems are usually optimized for writing, meaning that it is easier to input the data.</p><p>Source systems are usually not self-explanatory, but we can restructure and rename tables and fields, so data becomes more organized in a DW.</p><p><strong>A DW is schema-on-write</strong>, meaning the data&#8217;s structure is defined and enforced when the data is written into the system. Before you load data into the DW, you must decide what tables you need, their columns, data types, and relationships. When data comes in it must adapt to this schema.</p><p>Data quality and consistency are high because you&#8217;re controlling what goes in. Changes in the source systems will not cause issues in reports or analyses.</p><p>DWs are for all areas like Finance, HR, and Sales, and the data in them is very detailed, while Data Marts are built on DWs and contain only single subject area subsets.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Hzgg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F165723ad-614f-40a8-8e1b-206838b3462f_852x514.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Hzgg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F165723ad-614f-40a8-8e1b-206838b3462f_852x514.png 424w, https://substackcdn.com/image/fetch/$s_!Hzgg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F165723ad-614f-40a8-8e1b-206838b3462f_852x514.png 848w, https://substackcdn.com/image/fetch/$s_!Hzgg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F165723ad-614f-40a8-8e1b-206838b3462f_852x514.png 1272w, https://substackcdn.com/image/fetch/$s_!Hzgg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F165723ad-614f-40a8-8e1b-206838b3462f_852x514.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Hzgg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F165723ad-614f-40a8-8e1b-206838b3462f_852x514.png" width="852" height="514" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/165723ad-614f-40a8-8e1b-206838b3462f_852x514.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:514,&quot;width&quot;:852,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:85065,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159470144?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F165723ad-614f-40a8-8e1b-206838b3462f_852x514.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Hzgg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F165723ad-614f-40a8-8e1b-206838b3462f_852x514.png 424w, https://substackcdn.com/image/fetch/$s_!Hzgg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F165723ad-614f-40a8-8e1b-206838b3462f_852x514.png 848w, https://substackcdn.com/image/fetch/$s_!Hzgg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F165723ad-614f-40a8-8e1b-206838b3462f_852x514.png 1272w, https://substackcdn.com/image/fetch/$s_!Hzgg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F165723ad-614f-40a8-8e1b-206838b3462f_852x514.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Data Lake</h2><p><strong>A Data Lake is schema-on-read.</strong> You can load any kind of data raw and unstructured, in its original format. You define the schema <strong>when you read or query the data</strong>, not before.</p><p>DLs are good for storing huge data at low cost. You can put in it everything &#8220;just in case&#8221; you need it later. You may never touch a part of it.</p><p>You can explore if the data is useful or not before making the first modifications on it. It may be the case that it turns out that the data is not useful at all, so no waste of time and cost in processing it.</p><p>It can handle large files quickly and can be useful also for archiving the data.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3ppi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F656ef7e4-1157-46ef-b295-e6f786fe6e8b_1146x524.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3ppi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F656ef7e4-1157-46ef-b295-e6f786fe6e8b_1146x524.png 424w, https://substackcdn.com/image/fetch/$s_!3ppi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F656ef7e4-1157-46ef-b295-e6f786fe6e8b_1146x524.png 848w, https://substackcdn.com/image/fetch/$s_!3ppi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F656ef7e4-1157-46ef-b295-e6f786fe6e8b_1146x524.png 1272w, https://substackcdn.com/image/fetch/$s_!3ppi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F656ef7e4-1157-46ef-b295-e6f786fe6e8b_1146x524.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3ppi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F656ef7e4-1157-46ef-b295-e6f786fe6e8b_1146x524.png" width="1146" height="524" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/656ef7e4-1157-46ef-b295-e6f786fe6e8b_1146x524.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:524,&quot;width&quot;:1146,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:124291,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159470144?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F656ef7e4-1157-46ef-b295-e6f786fe6e8b_1146x524.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3ppi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F656ef7e4-1157-46ef-b295-e6f786fe6e8b_1146x524.png 424w, https://substackcdn.com/image/fetch/$s_!3ppi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F656ef7e4-1157-46ef-b295-e6f786fe6e8b_1146x524.png 848w, https://substackcdn.com/image/fetch/$s_!3ppi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F656ef7e4-1157-46ef-b295-e6f786fe6e8b_1146x524.png 1272w, https://substackcdn.com/image/fetch/$s_!3ppi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F656ef7e4-1157-46ef-b295-e6f786fe6e8b_1146x524.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Data Ground Up! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h2>Modern Data Warehouse</h2><p>In the MDW we combine the two structures above and it has 5 major steps:</p><ol><li><p>Ingest</p></li><li><p>Store - Data Lake</p></li><li><p>Transform</p></li><li><p>Model</p></li><li><p>Visualize/ML</p></li></ol><p>In the first step, we import the data from many sources into the lake in raw format.<br>In the MDW concept, the data is cleaned in the lake, so steps 2 and 3 are happening simultaneously. We will have raw data and a clean data layer in the lake.</p><p>Some end users, like Data Scientists, can already access data from the lake. For other users, the cleaning happening in step 3 may not be &#8220;clean enough&#8221;.</p><p>Step 4 models the data and puts it into a relational data warehouse. In some cases even star schema is created, so the analytics/reporting team could work with the data more easily.</p><p>In step 5 end users can drag and drop data fields into reports or do analytics since all the joins and preparation are done at this stage.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jYmE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b50c597-18ac-4d15-b0d6-84d33caa8a13_1791x817.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jYmE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b50c597-18ac-4d15-b0d6-84d33caa8a13_1791x817.png 424w, https://substackcdn.com/image/fetch/$s_!jYmE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b50c597-18ac-4d15-b0d6-84d33caa8a13_1791x817.png 848w, https://substackcdn.com/image/fetch/$s_!jYmE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b50c597-18ac-4d15-b0d6-84d33caa8a13_1791x817.png 1272w, https://substackcdn.com/image/fetch/$s_!jYmE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b50c597-18ac-4d15-b0d6-84d33caa8a13_1791x817.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jYmE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b50c597-18ac-4d15-b0d6-84d33caa8a13_1791x817.png" width="1456" height="664" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9b50c597-18ac-4d15-b0d6-84d33caa8a13_1791x817.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:664,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:184727,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159470144?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b50c597-18ac-4d15-b0d6-84d33caa8a13_1791x817.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jYmE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b50c597-18ac-4d15-b0d6-84d33caa8a13_1791x817.png 424w, https://substackcdn.com/image/fetch/$s_!jYmE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b50c597-18ac-4d15-b0d6-84d33caa8a13_1791x817.png 848w, https://substackcdn.com/image/fetch/$s_!jYmE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b50c597-18ac-4d15-b0d6-84d33caa8a13_1791x817.png 1272w, https://substackcdn.com/image/fetch/$s_!jYmE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b50c597-18ac-4d15-b0d6-84d33caa8a13_1791x817.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Data Fabric</h2><p>Data Fabric adds functionality to the MDW.</p><p>For example, we can add an API to our cleaned data, or use advanced security features for the Data Lake and Warehouse.</p><p>It is an additional layer on top of our existing MDW.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VMOX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ea869b-4942-45fe-9d33-a3fc9b6ec8b5_1791x817.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VMOX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ea869b-4942-45fe-9d33-a3fc9b6ec8b5_1791x817.png 424w, https://substackcdn.com/image/fetch/$s_!VMOX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ea869b-4942-45fe-9d33-a3fc9b6ec8b5_1791x817.png 848w, https://substackcdn.com/image/fetch/$s_!VMOX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ea869b-4942-45fe-9d33-a3fc9b6ec8b5_1791x817.png 1272w, https://substackcdn.com/image/fetch/$s_!VMOX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ea869b-4942-45fe-9d33-a3fc9b6ec8b5_1791x817.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VMOX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ea869b-4942-45fe-9d33-a3fc9b6ec8b5_1791x817.png" width="1456" height="664" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f4ea869b-4942-45fe-9d33-a3fc9b6ec8b5_1791x817.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:664,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:184727,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159470144?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ea869b-4942-45fe-9d33-a3fc9b6ec8b5_1791x817.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VMOX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ea869b-4942-45fe-9d33-a3fc9b6ec8b5_1791x817.png 424w, https://substackcdn.com/image/fetch/$s_!VMOX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ea869b-4942-45fe-9d33-a3fc9b6ec8b5_1791x817.png 848w, https://substackcdn.com/image/fetch/$s_!VMOX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ea869b-4942-45fe-9d33-a3fc9b6ec8b5_1791x817.png 1272w, https://substackcdn.com/image/fetch/$s_!VMOX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ea869b-4942-45fe-9d33-a3fc9b6ec8b5_1791x817.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Data Mesh</h2><p>Decentralization is a buzzword nowadays. Data cannot be a niche where we don&#8217;t use it.</p><p>Date Mesh is a decentralized data architecture. It is not a technology, but a concept. All the domains could use the same data lake, hence the lake would become decentralized.</p><p>In a Data Mesh, each domain has ownership over its data, and they make it available to other domains as a product. This can lead to a lot of chaos, so ideally, there is a central IT team that helps to create standardized processes for each domain.</p><p>A great Data Mesh is hard to build and it could take years. You need the whole organization to be on the same page for their data architecture decisions.</p><h2>Which to use?</h2><p>There are no clear &#8216;if this then that&#8217; answers to this question. It depends on the industry, budget, and people, but mostly the size and type of the data. As you can see from the notes above, the architecture gets more and more complex and their capacity increases as well.</p><p>You can also have a combination of all the above.</p><div><hr></div><p>Sources:</p><div id="youtube2-rmfbbPPkgp8" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;rmfbbPPkgp8&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="https://www.youtube-nocookie.com/embed/rmfbbPPkgp8?rel=0&amp;autoplay=0&amp;showinfo=0&amp;enablejsapi=0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div><p>https://www.jamesserra.com/</p>]]></content:encoded></item><item><title><![CDATA[The Leap Year Bug]]></title><description><![CDATA[How many days have passed since 1900-01-01?]]></description><link>https://datagroundup.com/p/the-leap-year-bug</link><guid isPermaLink="false">https://datagroundup.com/p/the-leap-year-bug</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Fri, 14 Mar 2025 13:03:42 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/ce8df3a9-1be8-4c3a-9859-6d1c05277231_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>How many days have passed since 1900-01-01?</p><p>It depends&#8230;</p><p>Wait, how can the answer be that it depends?</p><p>The answer depends on who you ask, Python or Excel.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!eZcT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d6c2912-9bf9-4dae-9e27-5de51b80b922_687x393.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eZcT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d6c2912-9bf9-4dae-9e27-5de51b80b922_687x393.png 424w, https://substackcdn.com/image/fetch/$s_!eZcT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d6c2912-9bf9-4dae-9e27-5de51b80b922_687x393.png 848w, https://substackcdn.com/image/fetch/$s_!eZcT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d6c2912-9bf9-4dae-9e27-5de51b80b922_687x393.png 1272w, https://substackcdn.com/image/fetch/$s_!eZcT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d6c2912-9bf9-4dae-9e27-5de51b80b922_687x393.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!eZcT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d6c2912-9bf9-4dae-9e27-5de51b80b922_687x393.png" width="687" height="393" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4d6c2912-9bf9-4dae-9e27-5de51b80b922_687x393.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:393,&quot;width&quot;:687,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28950,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159050879?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d6c2912-9bf9-4dae-9e27-5de51b80b922_687x393.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!eZcT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d6c2912-9bf9-4dae-9e27-5de51b80b922_687x393.png 424w, https://substackcdn.com/image/fetch/$s_!eZcT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d6c2912-9bf9-4dae-9e27-5de51b80b922_687x393.png 848w, https://substackcdn.com/image/fetch/$s_!eZcT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d6c2912-9bf9-4dae-9e27-5de51b80b922_687x393.png 1272w, https://substackcdn.com/image/fetch/$s_!eZcT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4d6c2912-9bf9-4dae-9e27-5de51b80b922_687x393.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!uQqf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe974e2b-a26f-45ac-8aa1-4cb4d084f6d6_481x199.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uQqf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe974e2b-a26f-45ac-8aa1-4cb4d084f6d6_481x199.png 424w, https://substackcdn.com/image/fetch/$s_!uQqf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe974e2b-a26f-45ac-8aa1-4cb4d084f6d6_481x199.png 848w, https://substackcdn.com/image/fetch/$s_!uQqf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe974e2b-a26f-45ac-8aa1-4cb4d084f6d6_481x199.png 1272w, https://substackcdn.com/image/fetch/$s_!uQqf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe974e2b-a26f-45ac-8aa1-4cb4d084f6d6_481x199.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!uQqf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe974e2b-a26f-45ac-8aa1-4cb4d084f6d6_481x199.png" width="481" height="199" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/be974e2b-a26f-45ac-8aa1-4cb4d084f6d6_481x199.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:199,&quot;width&quot;:481,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11377,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159050879?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe974e2b-a26f-45ac-8aa1-4cb4d084f6d6_481x199.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uQqf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe974e2b-a26f-45ac-8aa1-4cb4d084f6d6_481x199.png 424w, https://substackcdn.com/image/fetch/$s_!uQqf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe974e2b-a26f-45ac-8aa1-4cb4d084f6d6_481x199.png 848w, https://substackcdn.com/image/fetch/$s_!uQqf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe974e2b-a26f-45ac-8aa1-4cb4d084f6d6_481x199.png 1272w, https://substackcdn.com/image/fetch/$s_!uQqf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe974e2b-a26f-45ac-8aa1-4cb4d084f6d6_481x199.png 1456w" sizes="100vw"></picture><div></div></div></a></figure></div><p>45728 vs 45729. But why is that?</p><p>It is because of a bug/feature in Excel (and some other apps).</p><h2>The Leap Year Bug</h2><p>Lotus 1-2-3 was a spreadsheet app from Lotus Software (later IBM). It was released on 26 January 1983 (15388 days ago, according to my spreadsheet), and IBM shut it down in 2013. It looked like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4NK6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e24fac-9c7c-464c-8e16-ae147064d267_640x480.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4NK6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e24fac-9c7c-464c-8e16-ae147064d267_640x480.png 424w, https://substackcdn.com/image/fetch/$s_!4NK6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e24fac-9c7c-464c-8e16-ae147064d267_640x480.png 848w, https://substackcdn.com/image/fetch/$s_!4NK6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e24fac-9c7c-464c-8e16-ae147064d267_640x480.png 1272w, https://substackcdn.com/image/fetch/$s_!4NK6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e24fac-9c7c-464c-8e16-ae147064d267_640x480.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4NK6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e24fac-9c7c-464c-8e16-ae147064d267_640x480.png" width="640" height="480" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/53e24fac-9c7c-464c-8e16-ae147064d267_640x480.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:480,&quot;width&quot;:640,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:33565,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159050879?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e24fac-9c7c-464c-8e16-ae147064d267_640x480.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4NK6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e24fac-9c7c-464c-8e16-ae147064d267_640x480.png 424w, https://substackcdn.com/image/fetch/$s_!4NK6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e24fac-9c7c-464c-8e16-ae147064d267_640x480.png 848w, https://substackcdn.com/image/fetch/$s_!4NK6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e24fac-9c7c-464c-8e16-ae147064d267_640x480.png 1272w, https://substackcdn.com/image/fetch/$s_!4NK6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e24fac-9c7c-464c-8e16-ae147064d267_640x480.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><a href="https://en.wikipedia.org/wiki/Lotus_1-2-3">Wikipedia</a></figcaption></figure></div><p>It was popular in the &#8216;80s, just like Excel is today. But there was a big issue with it.</p><p>Lotus 1-2-3 assumed that 1900 was a leap year. But it was not.</p><p>To define a leap year, we can use this logic:</p><ul><li><p><strong>Divisible by 4</strong> &#8594; It&#8217;s a leap year</p></li><li><p><strong>Except</strong> if it&#8217;s also divisible by 100 &#8594; it&#8217;s <strong>not</strong> a leap year</p></li><li><p><strong>Unless</strong> it&#8217;s divisible by 400 &#8594; it <strong>is</strong> a leap year</p></li></ul><p>Or logically:</p><pre><code><code>(Y % 4 == 0) and ((Y % 100 != 0) or (Y % 400 == 0))
</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!T0YP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e073ee-3d99-42d0-8749-da54ed5b68d4_872x309.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!T0YP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e073ee-3d99-42d0-8749-da54ed5b68d4_872x309.png 424w, https://substackcdn.com/image/fetch/$s_!T0YP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e073ee-3d99-42d0-8749-da54ed5b68d4_872x309.png 848w, https://substackcdn.com/image/fetch/$s_!T0YP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e073ee-3d99-42d0-8749-da54ed5b68d4_872x309.png 1272w, https://substackcdn.com/image/fetch/$s_!T0YP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e073ee-3d99-42d0-8749-da54ed5b68d4_872x309.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!T0YP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e073ee-3d99-42d0-8749-da54ed5b68d4_872x309.png" width="872" height="309" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a6e073ee-3d99-42d0-8749-da54ed5b68d4_872x309.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:309,&quot;width&quot;:872,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:16637,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159050879?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e073ee-3d99-42d0-8749-da54ed5b68d4_872x309.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!T0YP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e073ee-3d99-42d0-8749-da54ed5b68d4_872x309.png 424w, https://substackcdn.com/image/fetch/$s_!T0YP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e073ee-3d99-42d0-8749-da54ed5b68d4_872x309.png 848w, https://substackcdn.com/image/fetch/$s_!T0YP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e073ee-3d99-42d0-8749-da54ed5b68d4_872x309.png 1272w, https://substackcdn.com/image/fetch/$s_!T0YP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e073ee-3d99-42d0-8749-da54ed5b68d4_872x309.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>1900 is divisible by 4 and 100 but not by 400 &#8594; Not a leap year.</p><p>2000 is divisible by all of them, so it is a leap year.</p><p>The engineers forgot about this, so Lotus had this bug.</p><p>Excel deliberately replicated the bug to maintain compatibility with Lotus, and to maintain compatibility with previous versions, Excel still has the bug.</p><p><strong>What about Python?</strong></p><p>Python doesn&#8217;t have this bug, so we have the differences in the results above.</p><p>Let&#8217;s check what happens if we want to import a dataset into pandas with the fake leap year in it.</p><p>Book1 doesn&#8217;t contain the Excel bug, while Book2 does.</p><p>No issue with Book1 as it is a regular CSV, but for Book2, it cannot convert the column to a datetime datatype; it remains an object.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!c3WD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F343b277b-cce2-460b-b74a-76760395421e_887x1136.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!c3WD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F343b277b-cce2-460b-b74a-76760395421e_887x1136.png 424w, https://substackcdn.com/image/fetch/$s_!c3WD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F343b277b-cce2-460b-b74a-76760395421e_887x1136.png 848w, https://substackcdn.com/image/fetch/$s_!c3WD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F343b277b-cce2-460b-b74a-76760395421e_887x1136.png 1272w, https://substackcdn.com/image/fetch/$s_!c3WD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F343b277b-cce2-460b-b74a-76760395421e_887x1136.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!c3WD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F343b277b-cce2-460b-b74a-76760395421e_887x1136.png" width="887" height="1136" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/343b277b-cce2-460b-b74a-76760395421e_887x1136.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1136,&quot;width&quot;:887,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:109568,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159050879?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F343b277b-cce2-460b-b74a-76760395421e_887x1136.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!c3WD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F343b277b-cce2-460b-b74a-76760395421e_887x1136.png 424w, https://substackcdn.com/image/fetch/$s_!c3WD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F343b277b-cce2-460b-b74a-76760395421e_887x1136.png 848w, https://substackcdn.com/image/fetch/$s_!c3WD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F343b277b-cce2-460b-b74a-76760395421e_887x1136.png 1272w, https://substackcdn.com/image/fetch/$s_!c3WD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F343b277b-cce2-460b-b74a-76760395421e_887x1136.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pNhn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99a99dc-9e58-432c-be03-210d74c647f4_300x993.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pNhn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99a99dc-9e58-432c-be03-210d74c647f4_300x993.png 424w, https://substackcdn.com/image/fetch/$s_!pNhn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99a99dc-9e58-432c-be03-210d74c647f4_300x993.png 848w, https://substackcdn.com/image/fetch/$s_!pNhn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99a99dc-9e58-432c-be03-210d74c647f4_300x993.png 1272w, https://substackcdn.com/image/fetch/$s_!pNhn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99a99dc-9e58-432c-be03-210d74c647f4_300x993.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pNhn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99a99dc-9e58-432c-be03-210d74c647f4_300x993.png" width="300" height="993" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a99a99dc-9e58-432c-be03-210d74c647f4_300x993.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:993,&quot;width&quot;:300,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:41214,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159050879?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99a99dc-9e58-432c-be03-210d74c647f4_300x993.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pNhn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99a99dc-9e58-432c-be03-210d74c647f4_300x993.png 424w, https://substackcdn.com/image/fetch/$s_!pNhn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99a99dc-9e58-432c-be03-210d74c647f4_300x993.png 848w, https://substackcdn.com/image/fetch/$s_!pNhn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99a99dc-9e58-432c-be03-210d74c647f4_300x993.png 1272w, https://substackcdn.com/image/fetch/$s_!pNhn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa99a99dc-9e58-432c-be03-210d74c647f4_300x993.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The difference is also visible on the outputs of the dfs.</p><p>Here is another example from Python:</p><pre><code><code>from datetime import date

today = date.today()
later = today.replace(year = today.year + 1)
</code></code></pre><p>If today is 2025-03-14, then:</p><ul><li><p><code>today</code> becomes <code>date(2025, 3, 14)</code></p></li><li><p><code>later</code> becomes <code>date(2026, 3, 14)</code></p></li></ul><p>since we added one year. This code works until you run it on February 29.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LnrU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fc0a217-b0c2-4396-a06a-6ce10f9ff471_1187x574.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LnrU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fc0a217-b0c2-4396-a06a-6ce10f9ff471_1187x574.png 424w, https://substackcdn.com/image/fetch/$s_!LnrU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fc0a217-b0c2-4396-a06a-6ce10f9ff471_1187x574.png 848w, https://substackcdn.com/image/fetch/$s_!LnrU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fc0a217-b0c2-4396-a06a-6ce10f9ff471_1187x574.png 1272w, https://substackcdn.com/image/fetch/$s_!LnrU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fc0a217-b0c2-4396-a06a-6ce10f9ff471_1187x574.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LnrU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fc0a217-b0c2-4396-a06a-6ce10f9ff471_1187x574.png" width="1187" height="574" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0fc0a217-b0c2-4396-a06a-6ce10f9ff471_1187x574.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:574,&quot;width&quot;:1187,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:56096,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/159050879?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fc0a217-b0c2-4396-a06a-6ce10f9ff471_1187x574.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LnrU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fc0a217-b0c2-4396-a06a-6ce10f9ff471_1187x574.png 424w, https://substackcdn.com/image/fetch/$s_!LnrU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fc0a217-b0c2-4396-a06a-6ce10f9ff471_1187x574.png 848w, https://substackcdn.com/image/fetch/$s_!LnrU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fc0a217-b0c2-4396-a06a-6ce10f9ff471_1187x574.png 1272w, https://substackcdn.com/image/fetch/$s_!LnrU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fc0a217-b0c2-4396-a06a-6ce10f9ff471_1187x574.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Generally, the leap year bug has two categories.</p><ul><li><p>Those that lead to error conditions, like the python code above.</p></li><li><p>Those that lead to incorrect data, bad aggregations, or &#8220;off by one&#8221; problems.</p></li></ul><p>Code and apps may crash due to the errors raised by Category 1. They are hard to miss.</p><p>Category 2, however, is the silent killer; it will not crash apps but can be dangerous if not handled correctly:</p><ul><li><p>Calculating &#8220;yearly averages&#8221; without accounting for that extra day in a leap year (366 vs. 365 days).</p></li><li><p>Querying a database for events between February 1 and February month end, but forgetting to involve February 29 for leap years.</p></li><li><p>Add &#8220;1 year&#8221; to February 29, and you land on March 1 or February 28. This can impact billing, invoices, etc.</p></li></ul><p>The bug can cause huge issues.</p><p>In 2024, for example</p><ul><li><p>Payment terminals at ICA grocery and pharmacy stores across Sweden failed to process transactions on February 29th.</p></li><li><p>Street lighting in Paris, France, was inadvertently turned off at midnight at the start of February 29th.</p></li></ul><p>Some more examples <a href="https://codeofmatt.com/list-of-2024-leap-day-bugs/">here</a>.</p><h3>Why no correction?</h3><p><a href="https://learn.microsoft.com/en-gb/office/troubleshoot/excel/wrongly-assumes-1900-is-leap-year">According to Microsoft</a>, the disadvantages of changing this behaviour outweigh the advantages.</p><p>With a change, all the dates would decrease by 1 day as they would take out a previous day from the system.</p><p>Since the compatible applications are &#8220;used to&#8221; this behaviour, changing it would require changes in all other programs as well.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Data Ground Up! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[The CLEAR Method for Visualization]]></title><description><![CDATA[Matt Harrison's Method for Effective Visuals]]></description><link>https://datagroundup.com/p/the-clear-method-for-visualization</link><guid isPermaLink="false">https://datagroundup.com/p/the-clear-method-for-visualization</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Wed, 05 Mar 2025 13:03:30 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/acadd833-45b7-4297-a7f5-fca0c3789a8b_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Visualizations are the most creative field in data, but we usually associate &#8220;creative&#8221; with &#8220;fancy.&#8221; Visualizations should not be fancy; they should be simple and clear and tell a great story.</p><p>In his new book, <a href="https://www.amazon.com/Effective-Visualization-Exploiting-Matplotlib-Treading/dp/B0DWLB6W99">Effective Visualization</a>, Matt Harrison discusses the CLEAR framework to make effective visuals that serve the purposes above. CLEAR stands for:</p><p><strong>C</strong> - Color<br><strong>L</strong> - Limits<br><strong>E</strong> - Explanation<br><strong>A</strong> - Audience<br><strong>R</strong> - References</p><h3>Color</h3><p>Color is the biggest asset for visualization. You can define/change a lot of things with it.</p><p>The best use of color is to guide the eye of the viewer. You can emphasize your story by graying out the &#8220;everything else&#8221; and keeping the most important points colorful.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PEwp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb3c871-2880-47d3-8cbc-cddfbbbf1a3b_2048x1616.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PEwp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb3c871-2880-47d3-8cbc-cddfbbbf1a3b_2048x1616.png 424w, https://substackcdn.com/image/fetch/$s_!PEwp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb3c871-2880-47d3-8cbc-cddfbbbf1a3b_2048x1616.png 848w, https://substackcdn.com/image/fetch/$s_!PEwp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb3c871-2880-47d3-8cbc-cddfbbbf1a3b_2048x1616.png 1272w, https://substackcdn.com/image/fetch/$s_!PEwp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb3c871-2880-47d3-8cbc-cddfbbbf1a3b_2048x1616.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PEwp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb3c871-2880-47d3-8cbc-cddfbbbf1a3b_2048x1616.png" width="1456" height="1149" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6eb3c871-2880-47d3-8cbc-cddfbbbf1a3b_2048x1616.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1149,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:282742,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/158426887?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb3c871-2880-47d3-8cbc-cddfbbbf1a3b_2048x1616.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PEwp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb3c871-2880-47d3-8cbc-cddfbbbf1a3b_2048x1616.png 424w, https://substackcdn.com/image/fetch/$s_!PEwp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb3c871-2880-47d3-8cbc-cddfbbbf1a3b_2048x1616.png 848w, https://substackcdn.com/image/fetch/$s_!PEwp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb3c871-2880-47d3-8cbc-cddfbbbf1a3b_2048x1616.png 1272w, https://substackcdn.com/image/fetch/$s_!PEwp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb3c871-2880-47d3-8cbc-cddfbbbf1a3b_2048x1616.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We can also use colors based on already existing associations. For example, we tend to attach blue to cold and red to warm. Red is bad, Green is good, and so on.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0OgD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44afaf7f-800a-4c9d-a83c-f1c8033163a5_600x506.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0OgD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44afaf7f-800a-4c9d-a83c-f1c8033163a5_600x506.png 424w, https://substackcdn.com/image/fetch/$s_!0OgD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44afaf7f-800a-4c9d-a83c-f1c8033163a5_600x506.png 848w, https://substackcdn.com/image/fetch/$s_!0OgD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44afaf7f-800a-4c9d-a83c-f1c8033163a5_600x506.png 1272w, https://substackcdn.com/image/fetch/$s_!0OgD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44afaf7f-800a-4c9d-a83c-f1c8033163a5_600x506.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0OgD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44afaf7f-800a-4c9d-a83c-f1c8033163a5_600x506.png" width="600" height="506" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/44afaf7f-800a-4c9d-a83c-f1c8033163a5_600x506.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:506,&quot;width&quot;:600,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:61457,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/158426887?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44afaf7f-800a-4c9d-a83c-f1c8033163a5_600x506.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0OgD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44afaf7f-800a-4c9d-a83c-f1c8033163a5_600x506.png 424w, https://substackcdn.com/image/fetch/$s_!0OgD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44afaf7f-800a-4c9d-a83c-f1c8033163a5_600x506.png 848w, https://substackcdn.com/image/fetch/$s_!0OgD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44afaf7f-800a-4c9d-a83c-f1c8033163a5_600x506.png 1272w, https://substackcdn.com/image/fetch/$s_!0OgD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44afaf7f-800a-4c9d-a83c-f1c8033163a5_600x506.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Matt suggests using 3 colors maximum. More can be overwhelming. Also, you need to think about colorblind people and how the chart will look in black and white or grayscale.</p><h3>Limits</h3><p>As a beginner, I wanted to create the fanciest visuals ever. I thought infographics that have a bunch of data on them were cool. But now I understand that the simpler, the better. Limits give you simplicity. Again, we are aiming for story, not art.</p><p>You should use the most basic charts like line plots, bar plots, scatter plots, and histograms. The audience will be familiar with these chart types, and familiarity makes understanding easier. For a new, fancy chart, they need to understand how the chart works first, then the story.</p><p>A simple visual like the above is easy to understand; it takes 3 seconds. But what happened here is a crime:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1ni-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8f106d4-7c03-4557-bdb4-62a6b8ce143f_620x550.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1ni-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8f106d4-7c03-4557-bdb4-62a6b8ce143f_620x550.png 424w, https://substackcdn.com/image/fetch/$s_!1ni-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8f106d4-7c03-4557-bdb4-62a6b8ce143f_620x550.png 848w, https://substackcdn.com/image/fetch/$s_!1ni-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8f106d4-7c03-4557-bdb4-62a6b8ce143f_620x550.png 1272w, https://substackcdn.com/image/fetch/$s_!1ni-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8f106d4-7c03-4557-bdb4-62a6b8ce143f_620x550.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1ni-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8f106d4-7c03-4557-bdb4-62a6b8ce143f_620x550.png" width="620" height="550" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b8f106d4-7c03-4557-bdb4-62a6b8ce143f_620x550.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:550,&quot;width&quot;:620,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:461279,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/158426887?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8f106d4-7c03-4557-bdb4-62a6b8ce143f_620x550.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1ni-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8f106d4-7c03-4557-bdb4-62a6b8ce143f_620x550.png 424w, https://substackcdn.com/image/fetch/$s_!1ni-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8f106d4-7c03-4557-bdb4-62a6b8ce143f_620x550.png 848w, https://substackcdn.com/image/fetch/$s_!1ni-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8f106d4-7c03-4557-bdb4-62a6b8ce143f_620x550.png 1272w, https://substackcdn.com/image/fetch/$s_!1ni-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8f106d4-7c03-4557-bdb4-62a6b8ce143f_620x550.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Your eyes are probably jumping around, trying to figure out where to look, and you get frustrated after 15 seconds of looking at the &#8220;visualization&#8221;.</p><p>There are no hard rules here. Remove unnecessary things where possible, but there is no problem with adding labels if you need them to tell the story.</p><p>Two plots are better than one crowded plot! Creating more visuals is ok until you keep them simple and they add to the story. Sometimes, it&#8217;s impossible to pack everything into one visual.</p><p>Use complex or novel charts <strong>only when absolutely necessary.</strong> There is no issue with coming up with new ideas, but keep it simple and consider understandability.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!JsDB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6dc3b16d-0bb8-4897-8321-6e55222e7767_886x499.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JsDB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6dc3b16d-0bb8-4897-8321-6e55222e7767_886x499.jpeg 424w, https://substackcdn.com/image/fetch/$s_!JsDB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6dc3b16d-0bb8-4897-8321-6e55222e7767_886x499.jpeg 848w, https://substackcdn.com/image/fetch/$s_!JsDB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6dc3b16d-0bb8-4897-8321-6e55222e7767_886x499.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!JsDB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6dc3b16d-0bb8-4897-8321-6e55222e7767_886x499.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JsDB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6dc3b16d-0bb8-4897-8321-6e55222e7767_886x499.jpeg" width="886" height="499" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6dc3b16d-0bb8-4897-8321-6e55222e7767_886x499.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:499,&quot;width&quot;:886,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:67905,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/158426887?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6dc3b16d-0bb8-4897-8321-6e55222e7767_886x499.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JsDB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6dc3b16d-0bb8-4897-8321-6e55222e7767_886x499.jpeg 424w, https://substackcdn.com/image/fetch/$s_!JsDB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6dc3b16d-0bb8-4897-8321-6e55222e7767_886x499.jpeg 848w, https://substackcdn.com/image/fetch/$s_!JsDB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6dc3b16d-0bb8-4897-8321-6e55222e7767_886x499.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!JsDB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6dc3b16d-0bb8-4897-8321-6e55222e7767_886x499.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Data Ground Up! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h3>Explanation</h3><p>Sometimes, the visual itself is enough to get the point, but titles, subtitles, legends, and labels can help.</p><p>Colors guide the eye, text guides the understanding. The shorter, the better; they can even be words, not whole sentences.</p><p>Consider the placement of your annotations. They should be close to the data they explain. Colors for text can be applied here as well, but stay within the limits mentioned above.</p><p>Arrows, circles, and callout values are other visual elements that can help with the exxpanation.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QH6J!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a71106d-271d-4c41-9ef8-779983f10182_1150x1312.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QH6J!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a71106d-271d-4c41-9ef8-779983f10182_1150x1312.png 424w, https://substackcdn.com/image/fetch/$s_!QH6J!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a71106d-271d-4c41-9ef8-779983f10182_1150x1312.png 848w, https://substackcdn.com/image/fetch/$s_!QH6J!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a71106d-271d-4c41-9ef8-779983f10182_1150x1312.png 1272w, https://substackcdn.com/image/fetch/$s_!QH6J!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a71106d-271d-4c41-9ef8-779983f10182_1150x1312.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QH6J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a71106d-271d-4c41-9ef8-779983f10182_1150x1312.png" width="1150" height="1312" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2a71106d-271d-4c41-9ef8-779983f10182_1150x1312.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1312,&quot;width&quot;:1150,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:123236,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/158426887?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a71106d-271d-4c41-9ef8-779983f10182_1150x1312.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QH6J!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a71106d-271d-4c41-9ef8-779983f10182_1150x1312.png 424w, https://substackcdn.com/image/fetch/$s_!QH6J!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a71106d-271d-4c41-9ef8-779983f10182_1150x1312.png 848w, https://substackcdn.com/image/fetch/$s_!QH6J!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a71106d-271d-4c41-9ef8-779983f10182_1150x1312.png 1272w, https://substackcdn.com/image/fetch/$s_!QH6J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a71106d-271d-4c41-9ef8-779983f10182_1150x1312.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Audience</h3><p>Knowing the audience is a must. You will not use jargon or niche words if you know that the audience cannot understand them. The sport chart above is kind of niche since someone not familiar with Tennis may have a hard time understanding it.</p><p>If you create visuals for a wide audience, keep your wording on grandma&#8217;s level. Simple always win like Serena Williams did.</p><p>You can use the same dataset to create different stories for different audiences. The sales team may be interested in revenue trends, while HR requires a story on salaries.</p><h3>References</h3><p>Cite the source! Tell the data source and what types of modifications you made to it.</p><p>By linking the source, you allow others to work on the same data. This is key for replicating the analysis or even improving it.</p><h4>Where to find good examples?</h4><p>FiveThrirtyEight collects its best charts every year. <a href="https://fivethirtyeight.com/features/the-56-best-and-weirdest-charts-we-made-in-2019/">Here is the 2019 edition</a> (Good examples in this post are from these collections)</p><p>Other big news sites like the NY Times and The Economist have awesome charts that follow the most important rules. Use these as inspiration and learn from their great visuals!</p><div><hr></div><p>Sources:</p><p><a href="https://www.amazon.com/Effective-Visualization-Exploiting-Matplotlib-Treading/dp/B0DWLB6W99">Effective Visualization: Exploiting Matplotlib &amp; Pandas by Matt Harrison</a></p><p><a href="https://fivethirtyeight.com/features/our-51-best-and-weirdest-charts-of-2021/">https://fivethirtyeight.com/features/our-51-best-and-weirdest-charts-of-2021/</a><br><a href="https://fivethirtyeight.com/features/the-56-best-and-weirdest-charts-we-made-in-2019/">https://fivethirtyeight.com/features/the-56-best-and-weirdest-charts-we-made-in-2019/</a><br><a href="https://visme.co/blog/bad-infographics/">https://visme.co/blog/bad-infographics/</a></p>]]></content:encoded></item><item><title><![CDATA[Use Chaos to Create True Random Numbers]]></title><description><![CDATA[In ML, we usually see code like the below.]]></description><link>https://datagroundup.com/p/use-chaos-to-create-true-random-numbers</link><guid isPermaLink="false">https://datagroundup.com/p/use-chaos-to-create-true-random-numbers</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Fri, 28 Feb 2025 13:03:19 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/9d4f90bb-8a64-4819-8f67-e46e123e8da1_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In ML, we usually see code like the below. <code>seed = 42</code> is used to set the seeding of the random number generator. But if it is random, why do we have this fixed number in it?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!i977!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66d85aa0-b949-4c0d-9250-0e49fba32288_4488x2800.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!i977!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66d85aa0-b949-4c0d-9250-0e49fba32288_4488x2800.png 424w, https://substackcdn.com/image/fetch/$s_!i977!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66d85aa0-b949-4c0d-9250-0e49fba32288_4488x2800.png 848w, https://substackcdn.com/image/fetch/$s_!i977!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66d85aa0-b949-4c0d-9250-0e49fba32288_4488x2800.png 1272w, https://substackcdn.com/image/fetch/$s_!i977!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66d85aa0-b949-4c0d-9250-0e49fba32288_4488x2800.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!i977!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66d85aa0-b949-4c0d-9250-0e49fba32288_4488x2800.png" width="1456" height="908" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/66d85aa0-b949-4c0d-9250-0e49fba32288_4488x2800.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:908,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:675446,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/158086022?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66d85aa0-b949-4c0d-9250-0e49fba32288_4488x2800.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!i977!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66d85aa0-b949-4c0d-9250-0e49fba32288_4488x2800.png 424w, https://substackcdn.com/image/fetch/$s_!i977!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66d85aa0-b949-4c0d-9250-0e49fba32288_4488x2800.png 848w, https://substackcdn.com/image/fetch/$s_!i977!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66d85aa0-b949-4c0d-9250-0e49fba32288_4488x2800.png 1272w, https://substackcdn.com/image/fetch/$s_!i977!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66d85aa0-b949-4c0d-9250-0e49fba32288_4488x2800.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>There are different types of number generators, the two main categories are:</p><ul><li><p>Pseudo-Random Number Generators (PRNGs)</p></li><li><p>True Random Number Generators (TRNGs)</p></li></ul><p>Let&#8217;s discuss each. But first, the basics:</p><h2>Random numbers</h2><p>One single random number is a value that we chose from the available options. All options have the same probability to be chosen, meaning, the distribution is uniform.</p><p>A sequence of random numbers means that we repeat the process above and the choices are not impacting future choices, so the drawing is independent.</p><p>Randomness is important in many fields and also used for various purposes in Data Science:</p><ul><li><p>Data sampling</p></li><li><p>Data splitting</p></li><li><p>Simulations</p></li></ul><p>Randomness has great advantages, but it is hard to make a computer act randomly. They follow the instructions no matter what. And that&#8217;s good. The same input should result in the expected output and not a random mess. Imagine that you open up the browser and type google.com, and it would open up a random website for you.<br>We need some methods to make them act more randomly.</p><h2>True Random Number Generators</h2><p>The real world is fortunately highly unpredictable, so we can use it as an input for computers. TRNGs usually use physical events to create the randomness. The events can vary from simple, like how you move your mouse to more advanced like nuclear radioavtive events involving quantum mechanics.</p><p><strong>The most fun way to create randomness is to create chaos.</strong></p><p>Cloudflare uses the coolest TRNGs. They have many lavalamps installed in the HQ office. One lavalamp alone is super random itself, as the liquid in it can take up infinite forms, but they have many of them. Moreover, since they are installed on one of the companies main corridors, people passing the lamps can add to the chaos.</p><p>A camera watches the lobby 24/7 and take photos. Since computers store photos as series of numbers, every photo is a truely random number.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!K96v!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24787909-31cb-4134-870f-17aa20fb1c05_2048x1152.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!K96v!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24787909-31cb-4134-870f-17aa20fb1c05_2048x1152.png 424w, https://substackcdn.com/image/fetch/$s_!K96v!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24787909-31cb-4134-870f-17aa20fb1c05_2048x1152.png 848w, https://substackcdn.com/image/fetch/$s_!K96v!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24787909-31cb-4134-870f-17aa20fb1c05_2048x1152.png 1272w, https://substackcdn.com/image/fetch/$s_!K96v!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24787909-31cb-4134-870f-17aa20fb1c05_2048x1152.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!K96v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24787909-31cb-4134-870f-17aa20fb1c05_2048x1152.png" width="1456" height="819" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/24787909-31cb-4134-870f-17aa20fb1c05_2048x1152.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:819,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:4842666,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/158086022?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24787909-31cb-4134-870f-17aa20fb1c05_2048x1152.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!K96v!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24787909-31cb-4134-870f-17aa20fb1c05_2048x1152.png 424w, https://substackcdn.com/image/fetch/$s_!K96v!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24787909-31cb-4134-870f-17aa20fb1c05_2048x1152.png 848w, https://substackcdn.com/image/fetch/$s_!K96v!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24787909-31cb-4134-870f-17aa20fb1c05_2048x1152.png 1272w, https://substackcdn.com/image/fetch/$s_!K96v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24787909-31cb-4134-870f-17aa20fb1c05_2048x1152.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In the London office Cloudflare uses pendulums. The unpredictable swings coming from these things mixed with the incoming lights and shadows make the installation super random.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RLNS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F212c57ed-10bb-463c-ad7a-484fcd89fede_512x341.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RLNS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F212c57ed-10bb-463c-ad7a-484fcd89fede_512x341.png 424w, https://substackcdn.com/image/fetch/$s_!RLNS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F212c57ed-10bb-463c-ad7a-484fcd89fede_512x341.png 848w, https://substackcdn.com/image/fetch/$s_!RLNS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F212c57ed-10bb-463c-ad7a-484fcd89fede_512x341.png 1272w, https://substackcdn.com/image/fetch/$s_!RLNS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F212c57ed-10bb-463c-ad7a-484fcd89fede_512x341.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RLNS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F212c57ed-10bb-463c-ad7a-484fcd89fede_512x341.png" width="512" height="341" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/212c57ed-10bb-463c-ad7a-484fcd89fede_512x341.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:341,&quot;width&quot;:512,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:352561,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/158086022?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F212c57ed-10bb-463c-ad7a-484fcd89fede_512x341.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RLNS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F212c57ed-10bb-463c-ad7a-484fcd89fede_512x341.png 424w, https://substackcdn.com/image/fetch/$s_!RLNS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F212c57ed-10bb-463c-ad7a-484fcd89fede_512x341.png 848w, https://substackcdn.com/image/fetch/$s_!RLNS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F212c57ed-10bb-463c-ad7a-484fcd89fede_512x341.png 1272w, https://substackcdn.com/image/fetch/$s_!RLNS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F212c57ed-10bb-463c-ad7a-484fcd89fede_512x341.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Here is a great illustration of how random a single pendulum can be.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3UTj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F754d14fd-a70a-4f1b-bb2d-8481587296ab_400x400.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3UTj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F754d14fd-a70a-4f1b-bb2d-8481587296ab_400x400.gif 424w, https://substackcdn.com/image/fetch/$s_!3UTj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F754d14fd-a70a-4f1b-bb2d-8481587296ab_400x400.gif 848w, https://substackcdn.com/image/fetch/$s_!3UTj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F754d14fd-a70a-4f1b-bb2d-8481587296ab_400x400.gif 1272w, https://substackcdn.com/image/fetch/$s_!3UTj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F754d14fd-a70a-4f1b-bb2d-8481587296ab_400x400.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3UTj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F754d14fd-a70a-4f1b-bb2d-8481587296ab_400x400.gif" width="400" height="400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/754d14fd-a70a-4f1b-bb2d-8481587296ab_400x400.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:400,&quot;width&quot;:400,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3469489,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/158086022?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F754d14fd-a70a-4f1b-bb2d-8481587296ab_400x400.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3UTj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F754d14fd-a70a-4f1b-bb2d-8481587296ab_400x400.gif 424w, https://substackcdn.com/image/fetch/$s_!3UTj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F754d14fd-a70a-4f1b-bb2d-8481587296ab_400x400.gif 848w, https://substackcdn.com/image/fetch/$s_!3UTj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F754d14fd-a70a-4f1b-bb2d-8481587296ab_400x400.gif 1272w, https://substackcdn.com/image/fetch/$s_!3UTj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F754d14fd-a70a-4f1b-bb2d-8481587296ab_400x400.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Another office from Cludflare includes the hanging rainbow mobiles that react to changes in its environment like door openings, and ambient light. As you can see, the bigger the chaos is the better for randomness.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Co9g!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef768804-cde3-4535-aa3a-5e5a750a5d4a_1594x1568.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Co9g!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef768804-cde3-4535-aa3a-5e5a750a5d4a_1594x1568.png 424w, https://substackcdn.com/image/fetch/$s_!Co9g!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef768804-cde3-4535-aa3a-5e5a750a5d4a_1594x1568.png 848w, https://substackcdn.com/image/fetch/$s_!Co9g!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef768804-cde3-4535-aa3a-5e5a750a5d4a_1594x1568.png 1272w, https://substackcdn.com/image/fetch/$s_!Co9g!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef768804-cde3-4535-aa3a-5e5a750a5d4a_1594x1568.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Co9g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef768804-cde3-4535-aa3a-5e5a750a5d4a_1594x1568.png" width="1456" height="1432" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ef768804-cde3-4535-aa3a-5e5a750a5d4a_1594x1568.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1432,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3801881,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/158086022?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef768804-cde3-4535-aa3a-5e5a750a5d4a_1594x1568.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Co9g!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef768804-cde3-4535-aa3a-5e5a750a5d4a_1594x1568.png 424w, https://substackcdn.com/image/fetch/$s_!Co9g!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef768804-cde3-4535-aa3a-5e5a750a5d4a_1594x1568.png 848w, https://substackcdn.com/image/fetch/$s_!Co9g!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef768804-cde3-4535-aa3a-5e5a750a5d4a_1594x1568.png 1272w, https://substackcdn.com/image/fetch/$s_!Co9g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef768804-cde3-4535-aa3a-5e5a750a5d4a_1594x1568.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>And finally, here is a great illustration showing how these sources turn into a random number that is impossible to predict.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NDeI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F531c5d05-bb25-4302-9d62-15b645b53853_1491x400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NDeI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F531c5d05-bb25-4302-9d62-15b645b53853_1491x400.png 424w, https://substackcdn.com/image/fetch/$s_!NDeI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F531c5d05-bb25-4302-9d62-15b645b53853_1491x400.png 848w, https://substackcdn.com/image/fetch/$s_!NDeI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F531c5d05-bb25-4302-9d62-15b645b53853_1491x400.png 1272w, https://substackcdn.com/image/fetch/$s_!NDeI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F531c5d05-bb25-4302-9d62-15b645b53853_1491x400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NDeI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F531c5d05-bb25-4302-9d62-15b645b53853_1491x400.png" width="1456" height="391" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/531c5d05-bb25-4302-9d62-15b645b53853_1491x400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:391,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:176544,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/158086022?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F531c5d05-bb25-4302-9d62-15b645b53853_1491x400.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NDeI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F531c5d05-bb25-4302-9d62-15b645b53853_1491x400.png 424w, https://substackcdn.com/image/fetch/$s_!NDeI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F531c5d05-bb25-4302-9d62-15b645b53853_1491x400.png 848w, https://substackcdn.com/image/fetch/$s_!NDeI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F531c5d05-bb25-4302-9d62-15b645b53853_1491x400.png 1272w, https://substackcdn.com/image/fetch/$s_!NDeI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F531c5d05-bb25-4302-9d62-15b645b53853_1491x400.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Data Ground Up! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h2>Pseudo-Random Number Generators</h2><p>The number generators we work with in our applications like Excel, Python are PRNGs. They cannot use chaos like the above. PRNGs use mathematical algorithms to create sequences that <strong>looks</strong> random. But the numbers are not truly random, they follow a predetermined sequence.</p><p>When I wrote &#8220;looks random&#8221; I meant if you see the numbers written out in a sequence. But when we visualize them, the story is different.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!di4p!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18ff77c-416f-4070-9b79-f954a0a144bf_512x567.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!di4p!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18ff77c-416f-4070-9b79-f954a0a144bf_512x567.png 424w, https://substackcdn.com/image/fetch/$s_!di4p!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18ff77c-416f-4070-9b79-f954a0a144bf_512x567.png 848w, https://substackcdn.com/image/fetch/$s_!di4p!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18ff77c-416f-4070-9b79-f954a0a144bf_512x567.png 1272w, https://substackcdn.com/image/fetch/$s_!di4p!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18ff77c-416f-4070-9b79-f954a0a144bf_512x567.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!di4p!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18ff77c-416f-4070-9b79-f954a0a144bf_512x567.png" width="512" height="567" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a18ff77c-416f-4070-9b79-f954a0a144bf_512x567.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:567,&quot;width&quot;:512,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:175574,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/158086022?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18ff77c-416f-4070-9b79-f954a0a144bf_512x567.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!di4p!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18ff77c-416f-4070-9b79-f954a0a144bf_512x567.png 424w, https://substackcdn.com/image/fetch/$s_!di4p!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18ff77c-416f-4070-9b79-f954a0a144bf_512x567.png 848w, https://substackcdn.com/image/fetch/$s_!di4p!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18ff77c-416f-4070-9b79-f954a0a144bf_512x567.png 1272w, https://substackcdn.com/image/fetch/$s_!di4p!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa18ff77c-416f-4070-9b79-f954a0a144bf_512x567.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><a href="https://boallen.com/random-numbers.html">Bo Allen created the above visual</a> to show that how a bad combination of language (PHP), operating system (Windows), and function (rand()) can cause some obvious patterns. (With the same code, different operating systems get different results)</p><p>We can see that random generators can be very bad, but the best are really good. The quality varies a lot.</p><p>Generally, PRNGs are an efficient way to create <em>randomness</em> since these algorithms are fast. Also, the deterministic nature can be advantageous.</p><p>We see the seed parameter in many codes, because the seed provides reproducibility. If you set it to be the same, the sequence created will be the same. Meaning, we can recreate our randomness for every run and test other parts of the code without changes in data.</p><p>Without reproducibility, testing is more challenging. If each execution produced entirely different random values, it would be difficult to determine whether changes in the output were caused by modifications in the code or simply by a new set of random inputs.</p><p>These algorithms are good for modeling and simulations, but not the best solution in cases where numbers must be truly unpredictable, like in gambling or data encryption.</p><p>PHPs documentation also highlights this. And it explains why rand() is more restiricted in Windows.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0n8i!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2262a9d7-0e8f-4fab-b09b-cd40afe694ae_1268x1225.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0n8i!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2262a9d7-0e8f-4fab-b09b-cd40afe694ae_1268x1225.png 424w, https://substackcdn.com/image/fetch/$s_!0n8i!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2262a9d7-0e8f-4fab-b09b-cd40afe694ae_1268x1225.png 848w, https://substackcdn.com/image/fetch/$s_!0n8i!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2262a9d7-0e8f-4fab-b09b-cd40afe694ae_1268x1225.png 1272w, https://substackcdn.com/image/fetch/$s_!0n8i!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2262a9d7-0e8f-4fab-b09b-cd40afe694ae_1268x1225.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0n8i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2262a9d7-0e8f-4fab-b09b-cd40afe694ae_1268x1225.png" width="1268" height="1225" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2262a9d7-0e8f-4fab-b09b-cd40afe694ae_1268x1225.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1225,&quot;width&quot;:1268,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:160798,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://datagroundup.com/i/158086022?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2262a9d7-0e8f-4fab-b09b-cd40afe694ae_1268x1225.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0n8i!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2262a9d7-0e8f-4fab-b09b-cd40afe694ae_1268x1225.png 424w, https://substackcdn.com/image/fetch/$s_!0n8i!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2262a9d7-0e8f-4fab-b09b-cd40afe694ae_1268x1225.png 848w, https://substackcdn.com/image/fetch/$s_!0n8i!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2262a9d7-0e8f-4fab-b09b-cd40afe694ae_1268x1225.png 1272w, https://substackcdn.com/image/fetch/$s_!0n8i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2262a9d7-0e8f-4fab-b09b-cd40afe694ae_1268x1225.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Conclusion</h3><p>Going down this rabbit hole I realised how important randomness can be and how fun or creative solutions run behind super secure systems. As said, computers are not random at all without some random inputs. But what about humans?</p><p>Check this out:</p><div id="youtube2-d6iQrh2TK98" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;d6iQrh2TK98&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="https://www.youtube-nocookie.com/embed/d6iQrh2TK98?rel=0&amp;autoplay=0&amp;showinfo=0&amp;enablejsapi=0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div><div><hr></div><p>Sources:<br><a href="https://www.cloudflare.com/learning/ssl/lava-lamp-encryption/">How do lava lamps help with Internet encryption? | Cloudflare</a></p><p><a href="https://blog.cloudflare.com/harnessing-office-chaos/">https://blog.cloudflare.com/harnessing-office-chaos/</a></p><p><a href="https://www.random.org/randomness/">https://www.random.org/randomness/</a></p><p><a href="https://www.random.org/analysis/#visual">https://www.random.org/analysis/#visual</a></p><p><a href="https://en.wikipedia.org/wiki/Lavarand">https://en.wikipedia.org/wiki/Lavarand</a></p>]]></content:encoded></item><item><title><![CDATA[BrAIn vs Brain - Statistics vs Logic]]></title><description><![CDATA[We know that correlation doesn&#8217;t imply causation.]]></description><link>https://datagroundup.com/p/brain-vs-brain-statistics-vs-logic</link><guid isPermaLink="false">https://datagroundup.com/p/brain-vs-brain-statistics-vs-logic</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Fri, 21 Feb 2025 13:02:35 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/ea95b1d0-0e6f-48ae-a13c-735eba2d6c00_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>We know that correlation doesn&#8217;t imply causation. Here is one great example:</p><p><br><a href="https://tylervigen.com/spurious/correlation/3268_popularity-of-the-first-name-stevie_correlates-with_netflixs-stock-price">Popularity of the first name Stevie correlates with Netflix&#8217;s stock price (NFLX) (r=0.996)</a></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Data Ground Up! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9iKi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8119bc26-a72d-480b-ba16-d845acf11359_600x392.svg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9iKi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8119bc26-a72d-480b-ba16-d845acf11359_600x392.svg 424w, https://substackcdn.com/image/fetch/$s_!9iKi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8119bc26-a72d-480b-ba16-d845acf11359_600x392.svg 848w, https://substackcdn.com/image/fetch/$s_!9iKi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8119bc26-a72d-480b-ba16-d845acf11359_600x392.svg 1272w, https://substackcdn.com/image/fetch/$s_!9iKi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8119bc26-a72d-480b-ba16-d845acf11359_600x392.svg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9iKi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8119bc26-a72d-480b-ba16-d845acf11359_600x392.svg" width="600" height="392" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8119bc26-a72d-480b-ba16-d845acf11359_600x392.svg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:392,&quot;width&quot;:600,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;A linear line chart with years as the X-axis and two variables on the Y-axis. The first variable is Popularity of the first name Stevie and the second variable is Netflix's stock price (NFLX).  The chart goes from 2003 to 2022, and the two variables track closely in value over that time.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A linear line chart with years as the X-axis and two variables on the Y-axis. The first variable is Popularity of the first name Stevie and the second variable is Netflix's stock price (NFLX).  The chart goes from 2003 to 2022, and the two variables track closely in value over that time." title="A linear line chart with years as the X-axis and two variables on the Y-axis. The first variable is Popularity of the first name Stevie and the second variable is Netflix's stock price (NFLX).  The chart goes from 2003 to 2022, and the two variables track closely in value over that time." srcset="https://substackcdn.com/image/fetch/$s_!9iKi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8119bc26-a72d-480b-ba16-d845acf11359_600x392.svg 424w, https://substackcdn.com/image/fetch/$s_!9iKi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8119bc26-a72d-480b-ba16-d845acf11359_600x392.svg 848w, https://substackcdn.com/image/fetch/$s_!9iKi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8119bc26-a72d-480b-ba16-d845acf11359_600x392.svg 1272w, https://substackcdn.com/image/fetch/$s_!9iKi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8119bc26-a72d-480b-ba16-d845acf11359_600x392.svg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Statistically, they are correlating, but we <em>know</em> it&#8217;s only pure chance and no connection. But how do we <em>know</em>? We use logical reasoning.</p><p>What is the difference between logic and statistics? They represent two different models for understanding the world. Each has strengths and weaknesses</p><h2>Statistics</h2><p>It uses math and works with probabilities, generalizing from patterns in data instead of relying on rules. It is good at making decisions based on previous examples and making predictions.</p><p>The data can be huge, even terabytes, and actually, Statistics thrives in data-rich environments where patterns can be learned. Machine learning, for example, depends heavily on statistical inference.</p><p>But&#8230;</p><ul><li><p>It can&#8217;t prove absolute correctness - only probabilities of correctness.</p></li><li><p>You will have a hard time with unreliable data.</p></li><li><p>It can lead to misleading conclusions. See the spurious correlation above.</p></li></ul><h2>Logic</h2><p>When you have a logical reasoning properly set up you can rely on its certainty, the conclusion follows the premises. For this reason, it&#8217;s usually easier to understand a logical system.</p><p>When there is no data, you must rely on logical reasoning. It is good in no-data or bad-data environments.</p><p>But&#8230;</p><ul><li><p>When solving logical problems, the more variables you have, the harder the solution becomes. Logic does not scale well.</p></li><li><p>Logical rules are strict and cannot be easily adapted to new data.</p></li><li><p>Cannot handle probability</p></li></ul><h2>Human Reasoning</h2><p>Neither approach is perfect, so we use both every day.</p><p><strong>Here are a few examples:</strong></p><p>We use logic to check if the door is locked. This is a binary (true/false) problem. If we remember locking the door and know it cannot unlock itself, we can logically conclude it&#8217;s locked.<br>&#8220;I turned the key and heard the lock click, so the door must be locked.&#8221;</p><p>The above example is called <strong>deductive reasoning</strong>. The structure follows<br><strong>General principle &#8594; Specific conclusion.</strong></p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{aligned} &amp; \\text{ if } A\\text{ is true, then } B\\text{ is true }\\\\ &amp; A\\text{ is true }\\\\ &amp; \\overline{\\text{ therefore, } B\\text{ is true}} \\end{aligned}&quot;,&quot;id&quot;:&quot;ODPLJBGSGV&quot;}" data-component-name="LatexBlockToDOM"></div><p>or its reverse:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{aligned} &amp; \\text{ if } A\\text{ is true, then } B\\text{ is true }\\\\ &amp; B\\text{ is false }\\\\ &amp; \\overline{\\text{ therefore, } A\\text{ is false}} \\end{aligned}&quot;,&quot;id&quot;:&quot;SJJNXNKBWO&quot;}" data-component-name="LatexBlockToDOM"></div><p>But that is too strict and we usually have more complex problems. Here are another examples:</p><p>When should we go to sleep? We rely on experiences to estimate how much sleep we need and how tired we will feel the next day. So we use statistics.<br>&#8220;When I sleep less than 6 hours, I feel exhausted the next day, so I&#8217;ll go to bed now.&#8221;</p><p>Deciding what to eat for lunch can be a mix. If we have dietary restrictions, we use logic (&#8220;I can&#8217;t eat peanuts because I&#8217;m allergic&#8221;). But if we&#8217;re choosing between two restaurants, we might rely on experiences (statistics).</p><p><strong>Most real-life decisions involve a mix of both logical and statistical reasoning, but also emotions and other factors like domain knowledge can impact the decision.</strong></p><p><strong>Consider this situation:</strong></p><blockquote><p>You are sitting in a caf&#233;, enjoying your breakfast. You reach for your cup and realize that your wallet is missing from the table. A moment later you notice a man in a hoodie walking toward the exit, looking suspicious. Maybe he stole your wallet?</p></blockquote><p>If you quickly jump to conclusions, your reasoning may follow the above-mentioned straightforward <strong>deductive reasoning:</strong></p><ol><li><p><strong>Premise 1:</strong> If someone takes my wallet, it will no longer be on the table.</p></li><li><p><strong>Premise 2:</strong> My wallet is no longer on the table.</p></li><li><p><strong>Conclusion:</strong> Someone must have taken it.</p></li></ol><p>This reasoning has one major gap: <strong>the conclusion assumes only one possible explanation.</strong></p><p>The wallet could have fallen under the table, you forgot that you put it into your bag and so on. We need a practical explanation that involves possibilities:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{aligned} &amp; \\text{ if } A\\text{ is true, then } B\\text{ is true }\\\\ &amp; B\\text{ is true }\\\\ &amp; \\overline{\\text{ therefore, } A\\text{ becomes more plausible}} \\end{aligned}&quot;,&quot;id&quot;:&quot;KQTFCVABSX&quot;}" data-component-name="LatexBlockToDOM"></div><p>In this case:</p><ul><li><p><strong>A</strong> = &#8220;The wallet was stolen.&#8221;</p></li><li><p><strong>B</strong> = &#8220;The wallet is missing.&#8221;</p></li><li><p>The fact that <strong>B is true</strong> might <strong>increase the plausibility of A, but it does not prove it.</strong></p></li></ul><p>We can make similar reasonings more subtle:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{aligned} &amp; \\text{ if } A\\text{ is true, then } B\\text{ becomes more plausible }\\\\ &amp; B\\text{ is true }\\\\ &amp; \\overline{\\text{ therefore, } A\\text{ becomes more plausible}} \\end{aligned}&quot;,&quot;id&quot;:&quot;STMLEIAWDV&quot;}" data-component-name="LatexBlockToDOM"></div><p><strong>Notice that we went from true or false statements to plausible.</strong></p><p>Let&#8217;s take a look at the correlation example again. How do we <em>know</em> that the relationship is not causal?</p><p>We apply logical reasoning and real-world knowledge (that comes from previous experiences - statistics):</p><ul><li><p>Is there a believable chain of events where names can influence stock price? <strong>Not really</strong></p></li><li><p>Is there a known mechanism that could prove this? <strong>Not really</strong></p></li><li><p>Do we have reverse causality? Could Netflix&#8217;s stock price changes influence the number of babies named Stevie? Or vice versa. <strong>Not really</strong></p></li><li><p>Is there a hidden factor that might affect both? <strong>Unlikely</strong></p></li></ul><h2>Reasoning of Machines</h2><p>AI, similarly to us, uses both statistical and logical reasoning.</p><p>Chatbots predict the most probable next word in a sentence based on data. Fraud Detecting models look at past transactions and assign a probability score to determine if a transaction is fraudulent.</p><p>Medical models diagnose diseases based on predefined logical conditions. Game-playing robots use if-then rules to make moves.</p><p>Of course, some models can combine them. Self-driving cars use logic for traffic rules (stop at a red light) and statistics for decision-making (predict if the pedestrian will cross).</p><p><strong>What is the difference between brain and brAIn then?</strong></p><p>J&#225;nos Neumann said in 1948,</p><blockquote><p>&#8220;You insist that there is something a machine cannot do. If you tell me precisely what it is that a machine cannot do, then I can always make a machine which will do just that!&#8221;</p></blockquote><p>When we say machines cannot think, we say that we cannot describe a problem in detail. Machines can think if we can define what thinking is.</p><p><strong>And they can be better than us!</strong> As mentioned above, statistics scales well, because we can use GBs of data to analyze. But humans cannot handle that much info in their brains. Also, logic cannot scale well. People can understand simple logical trees, but a logical tree with 100 outcomes will set your brain on fire, machines can handle those as well.</p><p>Again, it&#8217;s only on us to define our problems well, so machines can solve them.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Data Ground Up! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Why Your Friends Have More Friends Than You Have - Explained With Code.]]></title><description><![CDATA[Average class size paradox]]></description><link>https://datagroundup.com/p/why-your-friends-have-more-friends</link><guid isPermaLink="false">https://datagroundup.com/p/why-your-friends-have-more-friends</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Sat, 15 Feb 2025 13:12:44 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/9912723b-59a8-4fad-9f30-afbfa4a7e268_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>Average class size paradox</h2><p>If you go to a University website and check their statistics you will probably find a measure called &#8220;average class size&#8221;. It is a simple average but can be misleading.</p><p>Different measures have different meanings for other perspectives. Consider this example:</p><p>In a tiny University, there are only two classes. One is a large course with 90 freshmen, while the other is a small one with 10 seniors.</p><p><strong>What is the average class size?</strong></p><p>It depends on who you ask. If you ask the University then the answer will be 50. (90+10)/2. And that is correct, but can be misleading to students. For the University a course is a course and they are equally weighted.</p><p>If you ask a student, the answer will be totally different. A senior will say that 50 is way too many because they only have 10 people in a class. A freshman will say that 50 is not true when they are sitting with 89 people around them in every class.</p><p>90% of the University students feel that they have bigger classes than the average.</p><p>To understand the student perspective we need to do a weighted average calculation.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{aligned}(90 \\times 90)+(10 \\times 10) &amp; =8,100+100 \\\\ &amp; =8,200 .\\end{aligned}&quot;,&quot;id&quot;:&quot;XHDXFFQDRI&quot;}" data-component-name="LatexBlockToDOM"></div><p>90 people said that the class size is 90 and 10 said that the class size is 10. That&#8217;s why we need to &#8220;duplicate&#8221; the numbers. Since we have 100 students the &#8220;real average from the student perspective&#8221; will be 82. (8200/100)</p><p>You always hear from friends: &#8220;Ohh the beach is always so crowded. There are thousands of people there.&#8221; Then the statistics say that the average of visitors is only a few hundred. Now you know the explanation. When the beach is not crowded your friends are not there to notice it.</p><h2>Friendship paradox</h2><p>A similar pattern can occur with friends.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tciy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F574077d8-f12b-454d-a2b6-887459a01801_1454x834.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tciy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F574077d8-f12b-454d-a2b6-887459a01801_1454x834.png 424w, https://substackcdn.com/image/fetch/$s_!tciy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F574077d8-f12b-454d-a2b6-887459a01801_1454x834.png 848w, https://substackcdn.com/image/fetch/$s_!tciy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F574077d8-f12b-454d-a2b6-887459a01801_1454x834.png 1272w, https://substackcdn.com/image/fetch/$s_!tciy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F574077d8-f12b-454d-a2b6-887459a01801_1454x834.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tciy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F574077d8-f12b-454d-a2b6-887459a01801_1454x834.png" width="1454" height="834" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/574077d8-f12b-454d-a2b6-887459a01801_1454x834.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:834,&quot;width&quot;:1454,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:110108,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tciy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F574077d8-f12b-454d-a2b6-887459a01801_1454x834.png 424w, https://substackcdn.com/image/fetch/$s_!tciy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F574077d8-f12b-454d-a2b6-887459a01801_1454x834.png 848w, https://substackcdn.com/image/fetch/$s_!tciy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F574077d8-f12b-454d-a2b6-887459a01801_1454x834.png 1272w, https://substackcdn.com/image/fetch/$s_!tciy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F574077d8-f12b-454d-a2b6-887459a01801_1454x834.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Red has 1 friend, Yellow has 3, and Green and Blue have 2 friends each. This means 8 friends divided by 4 = 2 friends on average.</p><p>But what if we interview each color and ask how many friends their friends have? Here are the answers:</p><p>R: Y has 3<br>Y: R has 1, G has 2, and B has 2.<br>B: Y has 3, and G has 2<br>G: Y has 3, and B has 2.</p><p>If we add up the numbers the result is 18 and the reported names are 8 (note: we are not dividing by 4. We need to sum the number of names in the answers).</p><p>18/8 equals 2.25 (&gt;2). On average friends have more friends than the colors themselves.</p><p>Let&#8217;s take a closer look at the answers. Y occurs 3 times, R occurs once, G and B occurs 2 times each. The number of occurrences equals their number of friends. So we go back to the weighted average calculation. More popular friends are listed more and contribute more to the score.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Data Ground Up! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h2>Explained through code</h2><p>Let&#8217;s create some Python code to observe this in action. <strong>You can find the code at the bottom of this post!</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!b40H!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc275117-8795-4b92-b632-e9f0ee31e16e_6216x6976.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!b40H!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc275117-8795-4b92-b632-e9f0ee31e16e_6216x6976.png 424w, https://substackcdn.com/image/fetch/$s_!b40H!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc275117-8795-4b92-b632-e9f0ee31e16e_6216x6976.png 848w, https://substackcdn.com/image/fetch/$s_!b40H!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc275117-8795-4b92-b632-e9f0ee31e16e_6216x6976.png 1272w, https://substackcdn.com/image/fetch/$s_!b40H!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc275117-8795-4b92-b632-e9f0ee31e16e_6216x6976.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!b40H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc275117-8795-4b92-b632-e9f0ee31e16e_6216x6976.png" width="1456" height="1634" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fc275117-8795-4b92-b632-e9f0ee31e16e_6216x6976.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1634,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2109058,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!b40H!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc275117-8795-4b92-b632-e9f0ee31e16e_6216x6976.png 424w, https://substackcdn.com/image/fetch/$s_!b40H!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc275117-8795-4b92-b632-e9f0ee31e16e_6216x6976.png 848w, https://substackcdn.com/image/fetch/$s_!b40H!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc275117-8795-4b92-b632-e9f0ee31e16e_6216x6976.png 1272w, https://substackcdn.com/image/fetch/$s_!b40H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc275117-8795-4b92-b632-e9f0ee31e16e_6216x6976.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This code represents a <strong>Probability Mass Function (PMF)</strong>, which is a way to describe the probability of different numbers of friends in the population.</p><p>The <code>_normalize</code> method calculates the total number of people and divides each count by the total to get a probability distribution. We have <code>{2: 5, 5: 8, 10: 14}</code>, where the keys are the number of friends and the values are the number of people who have that many friends. The total number of people is <code>5 + 8 + 14 = 27</code>. So, the probability for each friend count:</p><ul><li><p><code>P(2 friends) = 5 / 27</code></p></li><li><p><code>P(5 friends) = 8 / 27</code></p></li><li><p><code>P(10 friends) = 14 / 27</code></p></li></ul><p>The <code>Mean</code> method calculates the mean number of friends in the actual distribution.</p><p>The <code>Bias</code> method creates a biased version of the PMF, where people with more friends are sampled more often. This is done by multiplying the probability by the number of friends, just like we did in the examples above.</p><p>Then we finally plot the results:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VUhh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27020c43-16d4-4324-a79b-f46ed17438ea_576x432.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VUhh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27020c43-16d4-4324-a79b-f46ed17438ea_576x432.png 424w, https://substackcdn.com/image/fetch/$s_!VUhh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27020c43-16d4-4324-a79b-f46ed17438ea_576x432.png 848w, https://substackcdn.com/image/fetch/$s_!VUhh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27020c43-16d4-4324-a79b-f46ed17438ea_576x432.png 1272w, https://substackcdn.com/image/fetch/$s_!VUhh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27020c43-16d4-4324-a79b-f46ed17438ea_576x432.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VUhh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27020c43-16d4-4324-a79b-f46ed17438ea_576x432.png" width="576" height="432" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/27020c43-16d4-4324-a79b-f46ed17438ea_576x432.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:432,&quot;width&quot;:576,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:25126,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VUhh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27020c43-16d4-4324-a79b-f46ed17438ea_576x432.png 424w, https://substackcdn.com/image/fetch/$s_!VUhh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27020c43-16d4-4324-a79b-f46ed17438ea_576x432.png 848w, https://substackcdn.com/image/fetch/$s_!VUhh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27020c43-16d4-4324-a79b-f46ed17438ea_576x432.png 1272w, https://substackcdn.com/image/fetch/$s_!VUhh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27020c43-16d4-4324-a79b-f46ed17438ea_576x432.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Mean number of friends (actual): 12.60. This tells us, &#8220;If you randomly pick a person, how many friends do they have?&#8221;</p><p><br>Mean number of friends (observed by friends): 16.69. This tells us, &#8220;If you randomly pick a friend from someone&#8217;s friend list, how many friends do they have?&#8221; People with <strong>more friends show up more often</strong> in this count.</p><p>The actual average number of friends is <strong>lower</strong> than the perceived number of friends.</p><p>PMF helps to compare the two distributions easily. The <strong>biased PMF is always shifted to the right</strong> (towards bigger numbers), meaning the observed friend count is higher.</p><div><hr></div><p>Main sources:</p><ul><li><p><a href="https://archive.nytimes.com/opinionator.blogs.nytimes.com/2012/09/17/friends-you-can-count-on/">Friends You Can Count On - The New York Times</a></p></li><li><p><a href="https://www.pewresearch.org/decoded/2020/02/20/the-class-size-paradox-how-individual-and-group-level-perspectives-differ-and-why-it-matters-in-research/">The &#8216;class size paradox&#8217;: How individual- and group-level perspectives differ, and why it matters in research | Pew Research Center</a></p></li><li><p><a href="https://greenteapress.com/thinkstats2/html/thinkstats2004.html">Probability mass functions</a></p></li></ul><div><hr></div><p>Code:</p><pre><code>import numpy as np
import matplotlib.pyplot as plt

class Pmf:
    """A simple class for Probability Mass Function (PMF) operations."""
    def __init__(self, data, label=''):
        self.label = label
        self.pmf = self._normalize(data)

    def _normalize(self, data):
        total = sum(data.values())
        return {k: v / total for k, v in data.items()}

    def Mean(self):
        return sum(k * p for k, p in self.pmf.items())

    def Bias(self):
        """Bias the PMF so that people with more friends are sampled more often."""
        biased_pmf = {k: v * k for k, v in self.pmf.items()}  # Multiply by k (friend count)
        total = sum(biased_pmf.values())
        return {k: v / total for k, v in biased_pmf.items()}

    def Plot(self, biased_pmf):
        x = list(self.pmf.keys())
        y_actual = list(self.pmf.values())
        y_biased = list(biased_pmf.values())

        plt.bar(x, y_actual, alpha=0.6, label="Actual Distribution")
        plt.bar(x, y_biased, alpha=0.6, label="Observed Distribution (biased)", color='red')
        plt.xlabel("Number of Friends")
        plt.ylabel("Probability")
        plt.legend()
        plt.show()

# Define a hypothetical friend distribution
friend_distribution = {
    2: 5,   # 5 people have 2 friends
    5: 8,   # 8 people have 5 friends
    10: 14, # 14 people have 10 friends
    15: 6,  # 6 people have 15 friends
    20: 10, # 10 people have 20 friends
    25: 5   # 5 people have 25 friends
}

pmf = Pmf(friend_distribution, label="actual")
biased_pmf = pmf.Bias()

print(f"Mean number of friends (actual): {pmf.Mean():.2f}")
print(f"Mean number of friends (observed by friends): {sum(k * v for k, v in biased_pmf.items()):.2f}")

# Plot actual vs biased distribution
pmf.Plot(biased_pmf)
</code></pre>]]></content:encoded></item><item><title><![CDATA[How To Handle NULLs In SQL]]></title><description><![CDATA[In the last post, I wrote about the chaos NULL can cause in SQL.]]></description><link>https://datagroundup.com/p/how-to-handle-nulls-in-sql</link><guid isPermaLink="false">https://datagroundup.com/p/how-to-handle-nulls-in-sql</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Wed, 12 Feb 2025 13:03:06 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/fe9f1fd8-41b9-4b38-91d1-098f24472184_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the last <a href="https://datagroundup.com/p/why-null-is-a-trouble-maker-in-sql?r=18swpa">post</a>, I wrote about the chaos NULL can cause in SQL. But if we have <code>NULL</code> already in the db, we cannot avoid working with them.</p><p>Let&#8217;s collect some best practices for handling <code>NULL</code> in SQL:</p><h2>IS NULL Condition</h2><p>One mistake beginners think is that <code>NULL</code> is a value that we can compare to numbers or other data types. But regular comparison operators like &#8220;=&#8221;, &#8220;&lt;&gt;&#8221;, &#8220;&lt;&#8220;, &#8220;&gt;&#8221; are not working with <code>NULL</code> in SQL. A NULL cannot be compared to another NULL either. <code>NULL = NULL</code> is <strong>FALSE</strong> because NULL means &#8220;unknown,&#8221; so two unknown values cannot be compared.</p><p>Here is a great exercise to understand the NULL logic:</p><p><code>employees</code> table contains the following values:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QYo7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983a587e-1f10-4c8c-9836-a59a129370cc_309x185.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QYo7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983a587e-1f10-4c8c-9836-a59a129370cc_309x185.png 424w, https://substackcdn.com/image/fetch/$s_!QYo7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983a587e-1f10-4c8c-9836-a59a129370cc_309x185.png 848w, https://substackcdn.com/image/fetch/$s_!QYo7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983a587e-1f10-4c8c-9836-a59a129370cc_309x185.png 1272w, https://substackcdn.com/image/fetch/$s_!QYo7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983a587e-1f10-4c8c-9836-a59a129370cc_309x185.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QYo7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983a587e-1f10-4c8c-9836-a59a129370cc_309x185.png" width="309" height="185" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/983a587e-1f10-4c8c-9836-a59a129370cc_309x185.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:185,&quot;width&quot;:309,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:9855,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QYo7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983a587e-1f10-4c8c-9836-a59a129370cc_309x185.png 424w, https://substackcdn.com/image/fetch/$s_!QYo7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983a587e-1f10-4c8c-9836-a59a129370cc_309x185.png 848w, https://substackcdn.com/image/fetch/$s_!QYo7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983a587e-1f10-4c8c-9836-a59a129370cc_309x185.png 1272w, https://substackcdn.com/image/fetch/$s_!QYo7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F983a587e-1f10-4c8c-9836-a59a129370cc_309x185.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><pre><code><code>SELECT * FROM employees where department_id = NULL;</code></code></pre><p>As mentioned above, = will not work with <code>NULL</code>, so the result will be an empty table (no rows returned).</p><p>If you are thinking with the &#8216;general&#8217; binary programming logic then you would expect that running the two lines below will return all the rows:</p><pre><code><code>SELECT * FROM employees WHERE department_id = 2;</code></code></pre><pre><code><code>SELECT * FROM employees WHERE department_id &lt;&gt; 2;</code></code></pre><p>But that&#8217;s wrong. The results are these:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!D5Gm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F598c2d46-450a-4253-beba-b180869f8a5c_304x242.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!D5Gm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F598c2d46-450a-4253-beba-b180869f8a5c_304x242.png 424w, https://substackcdn.com/image/fetch/$s_!D5Gm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F598c2d46-450a-4253-beba-b180869f8a5c_304x242.png 848w, https://substackcdn.com/image/fetch/$s_!D5Gm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F598c2d46-450a-4253-beba-b180869f8a5c_304x242.png 1272w, https://substackcdn.com/image/fetch/$s_!D5Gm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F598c2d46-450a-4253-beba-b180869f8a5c_304x242.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!D5Gm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F598c2d46-450a-4253-beba-b180869f8a5c_304x242.png" width="304" height="242" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/598c2d46-450a-4253-beba-b180869f8a5c_304x242.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:242,&quot;width&quot;:304,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11941,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!D5Gm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F598c2d46-450a-4253-beba-b180869f8a5c_304x242.png 424w, https://substackcdn.com/image/fetch/$s_!D5Gm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F598c2d46-450a-4253-beba-b180869f8a5c_304x242.png 848w, https://substackcdn.com/image/fetch/$s_!D5Gm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F598c2d46-450a-4253-beba-b180869f8a5c_304x242.png 1272w, https://substackcdn.com/image/fetch/$s_!D5Gm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F598c2d46-450a-4253-beba-b180869f8a5c_304x242.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Poor Charlie is missing since <code>NULL &lt;&gt; 2</code> is <code>UNKNOWN</code>.</p><p>To get all the values we need to add the following:</p><pre><code><code>SELECT * FROM employees WHERE department_id IS NULL</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kJhp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90e098ef-43fe-4619-8072-1b95ff921d56_308x64.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kJhp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90e098ef-43fe-4619-8072-1b95ff921d56_308x64.png 424w, https://substackcdn.com/image/fetch/$s_!kJhp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90e098ef-43fe-4619-8072-1b95ff921d56_308x64.png 848w, https://substackcdn.com/image/fetch/$s_!kJhp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90e098ef-43fe-4619-8072-1b95ff921d56_308x64.png 1272w, https://substackcdn.com/image/fetch/$s_!kJhp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90e098ef-43fe-4619-8072-1b95ff921d56_308x64.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kJhp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90e098ef-43fe-4619-8072-1b95ff921d56_308x64.png" width="308" height="64" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/90e098ef-43fe-4619-8072-1b95ff921d56_308x64.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:64,&quot;width&quot;:308,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:4842,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!kJhp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90e098ef-43fe-4619-8072-1b95ff921d56_308x64.png 424w, https://substackcdn.com/image/fetch/$s_!kJhp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90e098ef-43fe-4619-8072-1b95ff921d56_308x64.png 848w, https://substackcdn.com/image/fetch/$s_!kJhp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90e098ef-43fe-4619-8072-1b95ff921d56_308x64.png 1272w, https://substackcdn.com/image/fetch/$s_!kJhp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F90e098ef-43fe-4619-8072-1b95ff921d56_308x64.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>The <code>IS NULL</code> condition is used to return rows that contain the NULL values in a column. Its variation <code>IS NOT NULL</code> will return all non <code>NULL</code> values.</p><h2>ISNULL() is different!</h2><p><code>ISNULL()</code>function is different from <code>IS NULL</code>. Adding to the confusion different Database systems have different functionality assigned to them.</p><p><code>ISNULL(column, default_value)</code> replaces <code>NULL</code> with a given value in SQL Server.</p><pre><code><code>SELECT name, ISNULL(department_id, 'Not Assigned') AS department
FROM employees;</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!adGM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f53d1a1-129c-4313-933f-981c0f176ee3_184x185.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!adGM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f53d1a1-129c-4313-933f-981c0f176ee3_184x185.png 424w, https://substackcdn.com/image/fetch/$s_!adGM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f53d1a1-129c-4313-933f-981c0f176ee3_184x185.png 848w, https://substackcdn.com/image/fetch/$s_!adGM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f53d1a1-129c-4313-933f-981c0f176ee3_184x185.png 1272w, https://substackcdn.com/image/fetch/$s_!adGM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f53d1a1-129c-4313-933f-981c0f176ee3_184x185.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!adGM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f53d1a1-129c-4313-933f-981c0f176ee3_184x185.png" width="184" height="185" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5f53d1a1-129c-4313-933f-981c0f176ee3_184x185.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:185,&quot;width&quot;:184,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:7530,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!adGM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f53d1a1-129c-4313-933f-981c0f176ee3_184x185.png 424w, https://substackcdn.com/image/fetch/$s_!adGM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f53d1a1-129c-4313-933f-981c0f176ee3_184x185.png 848w, https://substackcdn.com/image/fetch/$s_!adGM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f53d1a1-129c-4313-933f-981c0f176ee3_184x185.png 1272w, https://substackcdn.com/image/fetch/$s_!adGM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5f53d1a1-129c-4313-933f-981c0f176ee3_184x185.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>In MySQL <code>ISNULL()</code> is used to test whether an expression is NULL or not. It returns <code>1</code> if the expression is <code>NULL</code>, and <code>0</code> otherwise.</p><pre><code><code>SELECT name, ISNULL(department_id) AS is_null
FROM employees;</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KyIM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f01a96-c0d3-4e41-9c69-88f6c269b5af_137x186.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KyIM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f01a96-c0d3-4e41-9c69-88f6c269b5af_137x186.png 424w, https://substackcdn.com/image/fetch/$s_!KyIM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f01a96-c0d3-4e41-9c69-88f6c269b5af_137x186.png 848w, https://substackcdn.com/image/fetch/$s_!KyIM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f01a96-c0d3-4e41-9c69-88f6c269b5af_137x186.png 1272w, https://substackcdn.com/image/fetch/$s_!KyIM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f01a96-c0d3-4e41-9c69-88f6c269b5af_137x186.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KyIM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f01a96-c0d3-4e41-9c69-88f6c269b5af_137x186.png" width="137" height="186" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/34f01a96-c0d3-4e41-9c69-88f6c269b5af_137x186.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:186,&quot;width&quot;:137,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:5537,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KyIM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f01a96-c0d3-4e41-9c69-88f6c269b5af_137x186.png 424w, https://substackcdn.com/image/fetch/$s_!KyIM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f01a96-c0d3-4e41-9c69-88f6c269b5af_137x186.png 848w, https://substackcdn.com/image/fetch/$s_!KyIM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f01a96-c0d3-4e41-9c69-88f6c269b5af_137x186.png 1272w, https://substackcdn.com/image/fetch/$s_!KyIM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34f01a96-c0d3-4e41-9c69-88f6c269b5af_137x186.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>In MySQL if we want to replace <code>NULL</code> we need to use the <code>IFNULL()</code> function. Confusing right?</p><p><code>IFNULL(column, default_value)</code> replaces <code>NULL</code> values with a specified default in MySQL.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://datagroundup.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Data Ground Up! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h2>NULLIF()</h2><p><code>NULLIF(expr1, expr2)</code> returns <code>NULL</code> if two expressions are equal, otherwise it returns the first expression. It is basically the same as:</p><pre><code><code>CASE WHEN (expr1 = expr2)
THEN NULL
ELSE V1 END</code></code></pre><h2>COALESCE()</h2><p>And finally, the one I use the most. You can pass many parameters into <code>COALESCE()</code> and it will return the first non <code>NULL</code> value. It checks all the values from left to right. This can replace most of the functions mentioned above.</p><p>Let&#8217;s look at some examples:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ASC6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430fb0e8-2d43-4a73-8b95-92819e47fcda_306x152.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ASC6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430fb0e8-2d43-4a73-8b95-92819e47fcda_306x152.png 424w, https://substackcdn.com/image/fetch/$s_!ASC6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430fb0e8-2d43-4a73-8b95-92819e47fcda_306x152.png 848w, https://substackcdn.com/image/fetch/$s_!ASC6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430fb0e8-2d43-4a73-8b95-92819e47fcda_306x152.png 1272w, https://substackcdn.com/image/fetch/$s_!ASC6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430fb0e8-2d43-4a73-8b95-92819e47fcda_306x152.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ASC6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430fb0e8-2d43-4a73-8b95-92819e47fcda_306x152.png" width="306" height="152" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/430fb0e8-2d43-4a73-8b95-92819e47fcda_306x152.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:152,&quot;width&quot;:306,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10894,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ASC6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430fb0e8-2d43-4a73-8b95-92819e47fcda_306x152.png 424w, https://substackcdn.com/image/fetch/$s_!ASC6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430fb0e8-2d43-4a73-8b95-92819e47fcda_306x152.png 848w, https://substackcdn.com/image/fetch/$s_!ASC6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430fb0e8-2d43-4a73-8b95-92819e47fcda_306x152.png 1272w, https://substackcdn.com/image/fetch/$s_!ASC6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430fb0e8-2d43-4a73-8b95-92819e47fcda_306x152.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><pre><code><code>SELECT name, COALESCE(phone_number, 'N/A') AS phone_number
FROM customers;</code></code></pre><p>If <code>phone_number</code> is <code>NULL</code>, it will be replaced with <code>'N/A'</code></p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-HWk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F926e4cc1-8500-4905-9ba2-51c4deb151f3_305x154.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-HWk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F926e4cc1-8500-4905-9ba2-51c4deb151f3_305x154.png 424w, https://substackcdn.com/image/fetch/$s_!-HWk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F926e4cc1-8500-4905-9ba2-51c4deb151f3_305x154.png 848w, https://substackcdn.com/image/fetch/$s_!-HWk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F926e4cc1-8500-4905-9ba2-51c4deb151f3_305x154.png 1272w, https://substackcdn.com/image/fetch/$s_!-HWk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F926e4cc1-8500-4905-9ba2-51c4deb151f3_305x154.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-HWk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F926e4cc1-8500-4905-9ba2-51c4deb151f3_305x154.png" width="305" height="154" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/926e4cc1-8500-4905-9ba2-51c4deb151f3_305x154.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:154,&quot;width&quot;:305,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11116,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-HWk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F926e4cc1-8500-4905-9ba2-51c4deb151f3_305x154.png 424w, https://substackcdn.com/image/fetch/$s_!-HWk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F926e4cc1-8500-4905-9ba2-51c4deb151f3_305x154.png 848w, https://substackcdn.com/image/fetch/$s_!-HWk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F926e4cc1-8500-4905-9ba2-51c4deb151f3_305x154.png 1272w, https://substackcdn.com/image/fetch/$s_!-HWk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F926e4cc1-8500-4905-9ba2-51c4deb151f3_305x154.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>We can add more parameters to it:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Wfdn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e0a633d-8cf0-464e-a06e-349afb67490d_515x121.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Wfdn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e0a633d-8cf0-464e-a06e-349afb67490d_515x121.png 424w, https://substackcdn.com/image/fetch/$s_!Wfdn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e0a633d-8cf0-464e-a06e-349afb67490d_515x121.png 848w, https://substackcdn.com/image/fetch/$s_!Wfdn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e0a633d-8cf0-464e-a06e-349afb67490d_515x121.png 1272w, https://substackcdn.com/image/fetch/$s_!Wfdn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e0a633d-8cf0-464e-a06e-349afb67490d_515x121.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Wfdn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e0a633d-8cf0-464e-a06e-349afb67490d_515x121.png" width="515" height="121" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0e0a633d-8cf0-464e-a06e-349afb67490d_515x121.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:121,&quot;width&quot;:515,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:13356,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Wfdn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e0a633d-8cf0-464e-a06e-349afb67490d_515x121.png 424w, https://substackcdn.com/image/fetch/$s_!Wfdn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e0a633d-8cf0-464e-a06e-349afb67490d_515x121.png 848w, https://substackcdn.com/image/fetch/$s_!Wfdn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e0a633d-8cf0-464e-a06e-349afb67490d_515x121.png 1272w, https://substackcdn.com/image/fetch/$s_!Wfdn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e0a633d-8cf0-464e-a06e-349afb67490d_515x121.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><pre><code><code>SELECT employee_id, name, COALESCE(home_phone, work_phone, mobile_phone, 'No phone available') AS contact_number
FROM employees;</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Hurf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87491359-fecf-49eb-a159-515043805f08_330x123.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Hurf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87491359-fecf-49eb-a159-515043805f08_330x123.png 424w, https://substackcdn.com/image/fetch/$s_!Hurf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87491359-fecf-49eb-a159-515043805f08_330x123.png 848w, https://substackcdn.com/image/fetch/$s_!Hurf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87491359-fecf-49eb-a159-515043805f08_330x123.png 1272w, https://substackcdn.com/image/fetch/$s_!Hurf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87491359-fecf-49eb-a159-515043805f08_330x123.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Hurf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87491359-fecf-49eb-a159-515043805f08_330x123.png" width="330" height="123" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/87491359-fecf-49eb-a159-515043805f08_330x123.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:123,&quot;width&quot;:330,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10465,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Hurf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87491359-fecf-49eb-a159-515043805f08_330x123.png 424w, https://substackcdn.com/image/fetch/$s_!Hurf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87491359-fecf-49eb-a159-515043805f08_330x123.png 848w, https://substackcdn.com/image/fetch/$s_!Hurf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87491359-fecf-49eb-a159-515043805f08_330x123.png 1272w, https://substackcdn.com/image/fetch/$s_!Hurf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87491359-fecf-49eb-a159-515043805f08_330x123.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>For John the first non <code>NULL</code> value going from left to right is <code>work_phone</code>, but for Mark since all are <code>NULL</code> we replace them with a default value.</p><p>You can also use it in calculations. <code>NULL</code> will impact all calculations. If you include a <code>NULL</code>, the result will be <code>NULL</code> as well.</p><p>If a column might have <code>NULL</code> values in a calculation, you can replace them with a default:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rxFJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfcab772-2572-405e-8505-9064acb145a3_226x154.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rxFJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfcab772-2572-405e-8505-9064acb145a3_226x154.png 424w, https://substackcdn.com/image/fetch/$s_!rxFJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfcab772-2572-405e-8505-9064acb145a3_226x154.png 848w, https://substackcdn.com/image/fetch/$s_!rxFJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfcab772-2572-405e-8505-9064acb145a3_226x154.png 1272w, https://substackcdn.com/image/fetch/$s_!rxFJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfcab772-2572-405e-8505-9064acb145a3_226x154.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rxFJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfcab772-2572-405e-8505-9064acb145a3_226x154.png" width="226" height="154" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bfcab772-2572-405e-8505-9064acb145a3_226x154.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:154,&quot;width&quot;:226,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:7487,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rxFJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfcab772-2572-405e-8505-9064acb145a3_226x154.png 424w, https://substackcdn.com/image/fetch/$s_!rxFJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfcab772-2572-405e-8505-9064acb145a3_226x154.png 848w, https://substackcdn.com/image/fetch/$s_!rxFJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfcab772-2572-405e-8505-9064acb145a3_226x154.png 1272w, https://substackcdn.com/image/fetch/$s_!rxFJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfcab772-2572-405e-8505-9064acb145a3_226x154.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><pre><code><code>SELECT order_id, price, discount, COALESCE(price - discount, price) AS final_price
FROM orders;</code></code></pre><p>If <code>discount</code> is <code>NULL</code>, <code>price - discount</code> would result in <code>NULL</code>.</p><p><code>COALESCE(price - discount, price)</code> ensures that if <code>discount</code> is <code>NULL</code>, the original <code>price</code> is used.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!EORs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadf5c41-3550-4cda-96a8-b83eeb5c1744_322x155.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EORs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadf5c41-3550-4cda-96a8-b83eeb5c1744_322x155.png 424w, https://substackcdn.com/image/fetch/$s_!EORs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadf5c41-3550-4cda-96a8-b83eeb5c1744_322x155.png 848w, https://substackcdn.com/image/fetch/$s_!EORs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadf5c41-3550-4cda-96a8-b83eeb5c1744_322x155.png 1272w, https://substackcdn.com/image/fetch/$s_!EORs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadf5c41-3550-4cda-96a8-b83eeb5c1744_322x155.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!EORs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadf5c41-3550-4cda-96a8-b83eeb5c1744_322x155.png" width="322" height="155" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/badf5c41-3550-4cda-96a8-b83eeb5c1744_322x155.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:155,&quot;width&quot;:322,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10361,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EORs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadf5c41-3550-4cda-96a8-b83eeb5c1744_322x155.png 424w, https://substackcdn.com/image/fetch/$s_!EORs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadf5c41-3550-4cda-96a8-b83eeb5c1744_322x155.png 848w, https://substackcdn.com/image/fetch/$s_!EORs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadf5c41-3550-4cda-96a8-b83eeb5c1744_322x155.png 1272w, https://substackcdn.com/image/fetch/$s_!EORs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadf5c41-3550-4cda-96a8-b83eeb5c1744_322x155.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Without <code>COALESCE()</code> we would be screwed.</p><pre><code><code>SELECT order_id, price, discount, 
       price - discount AS final_price
FROM orders;</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_fU9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1361978-1399-488c-8405-81ceb5ffd4fe_322x154.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_fU9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1361978-1399-488c-8405-81ceb5ffd4fe_322x154.png 424w, https://substackcdn.com/image/fetch/$s_!_fU9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1361978-1399-488c-8405-81ceb5ffd4fe_322x154.png 848w, https://substackcdn.com/image/fetch/$s_!_fU9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1361978-1399-488c-8405-81ceb5ffd4fe_322x154.png 1272w, https://substackcdn.com/image/fetch/$s_!_fU9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1361978-1399-488c-8405-81ceb5ffd4fe_322x154.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_fU9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1361978-1399-488c-8405-81ceb5ffd4fe_322x154.png" width="322" height="154" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a1361978-1399-488c-8405-81ceb5ffd4fe_322x154.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:154,&quot;width&quot;:322,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10125,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_fU9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1361978-1399-488c-8405-81ceb5ffd4fe_322x154.png 424w, https://substackcdn.com/image/fetch/$s_!_fU9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1361978-1399-488c-8405-81ceb5ffd4fe_322x154.png 848w, https://substackcdn.com/image/fetch/$s_!_fU9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1361978-1399-488c-8405-81ceb5ffd4fe_322x154.png 1272w, https://substackcdn.com/image/fetch/$s_!_fU9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1361978-1399-488c-8405-81ceb5ffd4fe_322x154.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>If you are running a webshop you probably don&#8217;t want to show <code>NULL</code> as the final price of a product.</p><p>Be careful out there with <code>NULL</code> and use the techniques mentioned above!</p>]]></content:encoded></item><item><title><![CDATA[Why NULL Is a Trouble-Maker in SQL - Explained with Ice Cream]]></title><description><![CDATA[Imagine that you are running an Ice Cream shop in your city.]]></description><link>https://datagroundup.com/p/why-null-is-a-trouble-maker-in-sql</link><guid isPermaLink="false">https://datagroundup.com/p/why-null-is-a-trouble-maker-in-sql</guid><dc:creator><![CDATA[Levi]]></dc:creator><pubDate>Fri, 07 Feb 2025 13:04:02 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/7d3468b6-9607-438c-8159-a5e29c3d5181_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Imagine that you are running an Ice Cream shop in your city. You are surveying people on paper to improve your service and one of your questions in the survey is the following:</p><blockquote><p><strong>Which is your favorite ice cream flavor?</strong></p></blockquote><p>Simple right? You expect a single flavor people will add as an answer.<br>After the survey period you sit down to record the answers into a database. Reaching this question you realize that the question was not simple at all, or at least the answers are not helpful.</p><h4>Missing values</h4><p>A customer answers your questions but leaves the favorite flavor answer box empty. You were expecting a choice, but they never gave one. You record because you don&#8217;t know their preference.</p><h4>Unknown Value</h4><p>The customer wrote something down, but you cannot read it. The answer was provided but got lost. You add <code>NULL </code>because the information exists, but it is unknown.</p><h4>Miscellaneous Value</h4><p>A customer walks in and lists chocolate, vanilla, or strawberry. Now you finally have somewhat good answers, but you expected a singular flavor. You record <code>NULL </code>because the preference doesn&#8217;t fit neatly into the expected answers.</p><h4>Inapplicable Value</h4><p>You see this answer: <em>Pepperoni Pizza</em>. That&#8217;s a great choice for sure, but not for an ice cream. You didn&#8217;t ask about favorite food. What do you do? You store <code>NULL </code>because no valid response applies.</p><h3>Let&#8217;s talk SQL</h3><p>In all the above cases, the system just sees <code>NULL </code>- but <code>NULL </code>doesn&#8217;t tell you <em>why</em> the data is missing.</p><p>If you&#8217;re trying to calculate the most popular flavor, do you count <code>NULL</code>s as &#8220;vanilla&#8221;? Do you ignore them? Should you assume they were &#8220;chocolate&#8221;?</p><p><code>NULL </code>ads complication to databases. It is a special value and has no data type, meaning it can appear in text, numerical, or any other columns as well. The biggest confusion comes from the fact that <code>NULL </code>can mean 4 things in SQL. It can be missing, unknown, miscellaneous, or inapplicable value in the data. <code>NULL </code>makes filtering, aggregating, and comparing data tricky because it isn&#8217;t truly a value.</p><p>Just like you at the ice cream shop with the answers, an SQL database struggles to interpret <code>NULL </code>correctly in queries. <code>NULL </code>behaves unpredictably when used in calculations and other operations. Staying at the ice cream shop example:</p><h4><code>NULL </code>in Math</h4><p>Imagine trying to count how many scoops of each flavor were sold today. But some orders are <code>NULL </code>in the &#8220;scoops&#8221; column. What happens when you add them up? <strong>The </strong><code>NULL </code><strong>will destroy the calculation and your result will be </strong><code>NULL </code><strong>.</strong></p><h4><code>NULL </code>in Comparisons</h4><p>You want to check if two customers ordered the same flavor. If one order is <code>NULL </code>, SQL doesn&#8217;t say &#8220;yes&#8221; or &#8220;no&#8221; - it says <strong>UNKNOWN</strong>. It&#8217;s like asking, <em>&#8220;Did two customers order the same thing?&#8221;</em> and getting the response: <em>&#8220;I have no idea.&#8221;</em> That&#8217;s SQL&#8217;s <strong>three-valued logic</strong> in action&#8212;<strong>TRUE, FALSE, and UNKNOWN.</strong></p><h4><code>NULL </code>in Sorting</h4><p>When sorting orders by flavor, <code>NULL </code><strong>sometimes appear at the top, sometimes at the bottom</strong>, depending on the database settings. It&#8217;s like rearranging your menu board but having mystery items that randomly jump to the top or bottom whenever you sort the list.</p><h4><code>NULL </code>in Grouping</h4><p><strong>They group for some operations but not for others</strong>.<br>It&#8217;s like reviewing your sales and seeing:</p><ul><li><p>Vanilla: 50 orders</p></li><li><p>Chocolate: 40 orders</p></li><li><p>NULL: ??? (How many? Do they even belong together?)</p></li></ul><h3>What to do then?</h3><p>If you are doing an online survey instead, you can set more limitations. People can only choose one value from a list of your flavors, you can mark the answer as a must, and so on.</p><p>The best problem-solving is prevention. In SQL you can add a <code>NOT NULL</code> constraint to avoid <code>NULL </code>and all the confusion that comes with it.</p><p>But if you end up with <code>NULL </code> in the DB, then you need to handle them. That&#8217;s a different story, so see you in the next post!</p>]]></content:encoded></item></channel></rss>