<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chitranjan Gupta on Medium]]></title>
        <description><![CDATA[Stories by Chitranjan Gupta on Medium]]></description>
        <link>https://medium.com/@chitranjangupta4195?source=rss-c55ddde8a7b3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xcd3MnlICHzhQ-GhzP2EXg@2x.jpeg</url>
            <title>Stories by Chitranjan Gupta on Medium</title>
            <link>https://medium.com/@chitranjangupta4195?source=rss-c55ddde8a7b3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 00:50:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chitranjangupta4195/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Psychological Guide for NRIs and Students Abroad.]]></title>
            <link>https://medium.com/@chitranjangupta4195/a-psychological-guide-for-nris-and-students-abroad-516eebcf86a1?source=rss-c55ddde8a7b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/516eebcf86a1</guid>
            <category><![CDATA[uncomfortable-truths]]></category>
            <category><![CDATA[nri]]></category>
            <category><![CDATA[psychology]]></category>
            <category><![CDATA[communication]]></category>
            <category><![CDATA[indian-students-abroad]]></category>
            <dc:creator><![CDATA[Chitranjan Gupta]]></dc:creator>
            <pubDate>Fri, 02 Jan 2026 10:19:20 GMT</pubDate>
            <atom:updated>2026-01-02T10:19:20.492Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How to speak about life abroad without turning conversations into ideological battles. </em><strong><em>Unfortunately, it majorly relates to an Indian living abroad and not many non-Indians.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9r3zUwoeucv-63p-8n4F_w.png" /></figure><h3>The Uncomfortable Conversation</h3><p>If you are an NRI student or professional, this scene will feel painfully familiar.</p><p>You have been abroad for a while — long enough to struggle, adapt, fail, learn, and slowly build a life. You have handled loneliness, paperwork, part-time work, cultural shock, financial pressure, and the quiet fear of whether all of this will be worth it. You didn’t just move countries, <strong>you rebuilt yourself</strong>.</p><p>One evening, you are on a long, happy call with friends or family back in India. Laughter flows. Nostalgia hits. And then — almost casually — the conversation shifts:</p><blockquote><em>“So… is it really better there, or is India still the best?”</em></blockquote><p>What follows is rarely a discussion. It becomes a subtle trial.</p><p>You begin listing what you’ve observed:</p><ul><li>Better work-life balance</li><li>Systems that work</li><li>Cleaner public spaces</li><li>Predictable laws</li><li>Less daily chaos</li></ul><p>And suddenly, the tone changes.</p><p>You sense resistance. Defensiveness. Emotional pushback. Logic gives way to loyalty. Before you know it, you are no longer sharing experiences — you are <em>defending a choice</em>.</p><p>This article is not about proving whether India or Germany (or any other country) is better.</p><p>It is about <strong>why these conversations feel so uncomfortable</strong> — and how NRI students and professionals can navigate them without frustration, guilt, or emotional exhaustion.</p><h3>Why Your Points Don’t Land (Even When They Are True)</h3><p>The biggest mistake NRIs make is assuming that disagreement comes from ignorance.</p><p>Most of the time, it doesn’t. It comes from <strong>psychology</strong>.</p><h3>1. Identity Over Information</h3><p>For many people in India, <em>India is not just a country</em>. It is identity.</p><p>When you criticize systems, governance, civic sense, or social structures, it doesn’t register as analysis. It registers as <strong>personal rejection</strong>.</p><p>Psychologically, the brain treats this as a threat.</p><p>So instead of evaluating your argument, the mind moves into defense mode:</p><ul><li>“Every country has problems.”</li><li>“At least we have family.”</li><li>“You people forget your roots.”</li></ul><p>These are not logical counters. They are <strong>emotional shields</strong>.</p><h3>2. The Asymmetry of Experience</h3><p>You have lived <em>both</em> realities. They have lived <em>one</em>.</p><p>This creates an invisible imbalance.</p><p>You speak from comparison. They listen from imagination.</p><p>But imagination is always filtered through:</p><ul><li>Media narratives</li><li>National pride</li><li>Social validation</li><li>Fear of the unknown</li></ul><p>So when you say, “Life feels more predictable here,” they hear, “India is unlivable.”</p><p>That is not what you said — but that is what their psychology translates.</p><h3>3. Justification of Staying</h3><p>Not everyone stays in India by pure choice.</p><p>Some stay because of:</p><ul><li>Family responsibility</li><li>Financial constraints</li><li>Fear of starting over</li><li>Risk aversion</li></ul><p>When you describe life abroad positively, it can unintentionally highlight <em>paths not taken</em>.</p><p>To protect self-esteem, the mind responds by devaluing your choice.</p><blockquote><em>“It’s not worth it anyway.”</em></blockquote><p>This is not an attack on you. It is <strong>self-preservation</strong>.</p><h3>The Silent Burden NRIs Carry</h3><p>Here’s the part rarely acknowledged.</p><p>When you speak positively about life abroad:</p><ul><li>You’re called ungrateful</li><li>You’re accused of arrogance</li><li>You’re told you’ve changed</li></ul><p>When you speak about struggles:</p><ul><li>You’re told to come back</li><li>You’re told it’s your fault</li><li>You’re told India is still better</li></ul><p>You lose either way.</p><p>So many NRIs learn an unhealthy coping strategy:</p><p><em>Stay quiet. Avoid the topic. Downplay your experience.</em></p><h4><strong>But silence creates distance. And distance slowly turns into loneliness.</strong></h4><h3>Reframing the Conversation: What Actually Works</h3><p>The goal is <strong>not</strong> to convince.</p><p>The goal is <strong>to communicate without triggering defense</strong>.</p><h3>1. Shift From Comparison to Experience</h3><p>Instead of saying:</p><blockquote><em>“Germany is better than India because…”</em></blockquote><p>Try:</p><blockquote><em>“What surprised me personally was how differently things work here.”</em></blockquote><p>This removes hierarchy and introduces curiosity.</p><p>People argue with comparisons. They listen to stories.</p><h3>2. Acknowledge Emotional Truths First</h3><p>Before listing facts, acknowledge what India gives:</p><ul><li>Familiarity</li><li>Emotional support</li><li>Cultural comfort</li></ul><p>This signals respect.</p><p>Once people feel respected, they stop fighting to be heard.</p><h3>3. Stop Expecting Validation</h3><p>One of the hardest truths for NRIs:</p><p>You may never receive full validation for your decision — especially from people who didn’t take the same risk.</p><p>And that’s okay.</p><p>Your growth does not require their approval.</p><h3>4. Choose Connection Over Correction</h3><p>Ask yourself quietly:</p><blockquote><em>“Do I want to be understood, or do I want to be right?”</em></blockquote><p>In relationships, being right often costs connection.</p><h3>A Question Worth Sitting With</h3><p>Instead of asking:</p><p><strong>“Why don’t they understand me?”</strong></p><p>Try asking:</p><blockquote><em>1. </em>“What fear or value is my experience touching inside them?”</blockquote><p>And equally important:</p><blockquote><em>2. </em>“Why do I need them to agree for my choice to feel valid?”</blockquote><h3>Final Thought</h3><p>Living abroad changes you.</p><p>Not because the country is superior — but because <strong>distance forces reflection</strong>.</p><p>You see systems more clearly. You see people differently. You see yourself honestly.</p><p>And when you speak from that place, remember:</p><p>Not every conversation is a debate.<br>Some are emotional negotiations.<br>Some are mirrors.<br>And some are better handled with grace than with logic.</p><p>If you are an NRI student or professional struggling with these conversations — you are not weak, arrogant, or confused.</p><p>You are simply standing between two worlds.</p><p>And that space is uncomfortable — but deeply transformative.</p><p><em>If this resonated with you, reflect on this:</em><br>How do <strong>you</strong> navigate conversations with people who love you but don’t share your worldview?</p><p>Help me understand more in the comments below. 👇</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=516eebcf86a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git Commands you should know]]></title>
            <link>https://medium.com/codex/git-going-the-essential-guide-to-version-control-af540099b659?source=rss-c55ddde8a7b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/af540099b659</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[project-management]]></category>
            <dc:creator><![CDATA[Chitranjan Gupta]]></dc:creator>
            <pubDate>Fri, 09 Aug 2024 07:01:43 GMT</pubDate>
            <atom:updated>2024-08-24T10:59:23.327Z</atom:updated>
            <content:encoded><![CDATA[<h3>Github Commands you should know</h3><blockquote><strong>All basic Commands to control your projects on GitHub.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rohh4vTk8JNZBfAyLsjkXw.png" /><figcaption><a href="https://www.canva.com/design/DAGNAe1ltMA/CV-mMu1hnILTj_BD9y1HxQ/edit?utm_content=DAGNAe1ltMA&amp;utm_campaign=designshare&amp;utm_medium=link2&amp;utm_source=sharebutton">Canva.com</a></figcaption></figure><h3>Version Control Systems?</h3><p><em>Version Control Systems (VCS)</em> are essential tools for managing changes to source code over time. They allow developers to track revisions, collaborate with others, and revert to previous versions when necessary. <strong>Git </strong>is a popular distributed VCS that enables seamless coordination among team members, making it indispensable for modern software development.</p><p>Beyond software development, Git and other VCS tools are also very useful in <em>data science</em> and <em>analytics</em>. They help data scientists keep track of data preprocessing scripts, model iterations, and analysis results. By using VCS, teams can ensure <strong>reproducibility </strong>and <strong>collaborate </strong>more effectively on projects, which is vital in the rapidly evolving field of data science.</p><h3># Installing Git and GitHub</h3><p><strong>1. Download and Install Git:</strong></p><ul><li>Visit the official Git website and download the installer for your operating system.</li><li>Follow the installation instructions to set up Git on your machine.</li></ul><p><strong>2. Setting Up GitHub:</strong></p><ul><li>Create a GitHub account at <a href="https://github.com/"><strong><em>GitHub</em></strong></a>.</li><li>Install <em>GitHub Desktop</em> or configure Git to connect with your GitHub account using the command line.</li></ul><h3># Git Basic Commands</h3><p><strong>1. Initializing a Repository:</strong></p><pre>#Create a new repository by navigating to your project directory and running:<br><br>git init</pre><p>This command initializes a new Git repository in your current directory. It creates a <strong>.git</strong> directory that stores all the information about your repository, including configuration, branches, and history.</p><p><strong>Example:</strong></p><pre>mkdir my_project<br>cd my_project<br>git init</pre><p><em>This sequence of commands creates a new directory called </em><strong><em>my_project</em></strong><em>, navigates into it, and initializes a new Git repository there.</em></p><p><strong>2. Cloning a Repository:</strong></p><pre>#To make a local copy of an existing repository, use:<br><br>git clone &lt;repository-url&gt;</pre><p>This command copies a repository from a remote server (like GitHub) to your local machine.</p><p><strong>Example:</strong></p><pre>git clone https://github.com/username/repo.git</pre><p><em>This command clones the repository located at the specified URL into a new directory named </em><strong><em>repo </em></strong><em>on your local machine.</em></p><p><strong>3. Staging and Committing Changes:</strong></p><pre>#Track changes to your files by adding them to the staging area:<br><br>git add &lt;filename&gt;</pre><pre>#Save your changes to the repository with a commit message:<br><br>git commit -m &quot;Your commit message&quot;</pre><p>The <strong>git add</strong> command stages changes (new or modified files) to be included in the next commit, while <strong>git commit</strong> records those changes in the repository&#39;s history with a descriptive message.</p><p><strong>Example:</strong></p><pre>echo &quot;Hello, World!&quot; &gt; hello.txt<br>git add hello.txt<br>git commit -m &quot;Add hello.txt with greeting&quot;</pre><p><em>This creates a new file </em><strong><em>hello.txt</em></strong><em>, stages it, and commits it with a message.</em></p><p><strong>4. Viewing Commit History:</strong></p><pre>#To see a log of all commits made to the repository, use:<br><br>git log</pre><p><em>This command shows a list of all the commits in the repository, including the commit hash, author, date, and message.</em></p><p><strong>5. Branching and Merging:</strong></p><pre>#Create a new branch for developing features independently:<br>git branch &lt;branch-name&gt; #&#39;master&#39; or &#39;main&#39; or custom-branch<br><br>#Switch to the new branch:<br>git checkout &lt;branch-name&gt;<br><br>#Merge changes from another branch into your current branch:<br>git merge &lt;branch-name&gt;</pre><p>Branching allows you to work on different features or fixes simultaneously without affecting the main codebase. Merging integrates these changes back into the main branch.</p><p><strong>Example:</strong></p><pre>git branch new-feature<br>git checkout new-feature<br># Make changes and commit them<br>git checkout main<br>git merge new-feature</pre><p><em>This sequence of commands creates a new branch called </em><strong><em>new-feature</em></strong><em>, switches to it, makes some changes (not shown), and then merges those changes back into the </em><strong><em>main </em></strong><em>branch.</em></p><p><strong>6. Handling Merge Conflicts:</strong></p><p>If Git cannot automatically merge changes, a conflict occurs. Resolve it by manually editing the conflicting files and then completing the merge:</p><pre>git add &lt;filename&gt;<br>git commit -m &quot;Resolved merge conflict&quot;</pre><p>Merge conflicts happen when changes in different branches conflict with each other. You need to manually resolve these conflicts and then commit the resolved changes.</p><p><strong>Example:</strong></p><pre># During a merge, a conflict occurs<br># Edit the conflicting file(s) to resolve the conflict<br>git add conflict-file.txt<br>git commit -m &quot;Resolved merge conflict in conflict-file.txt&quot;</pre><p><em>This resolves a merge conflict by manually editing the conflicting file and then staging and committing the resolved file.</em></p><h3># Summary</h3><p>Mastering Git basics is essential for any developer or data scientist looking to work efficiently and collaboratively. From initializing repositories to handling merge conflicts, understanding these fundamental commands ensures smooth project management and version control.</p><p>If you found this guide helpful, please like👏 and share it with others who might benefit from learning about Git.</p><p>Happy to welcome new publications! Please reach out to me!</p><p>Follow <a href="https://medium.com/@chitranjangupta4195"><strong><em>Chitranjan Gupta</em></strong></a> for more such content. Happy coding!</p><h4>More Related Articles</h4><ul><li><a href="https://medium.com/codex/data-cleaning-using-pandas-c65e20a84c4b">Data Cleaning using Pandas</a></li><li><a href="https://medium.com/@chitranjangupta4195/learn-statistics-for-data-science-f35e5e65668f">How to learn Statistics</a></li><li><a href="https://medium.com/codex/use-sql-this-way-for-data-cleaning-c4de94057953">Use SQL this way for Data Cleaning</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af540099b659" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codex/git-going-the-essential-guide-to-version-control-af540099b659">Git Commands you should know</a> was originally published in <a href="https://medium.com/codex">CodeX</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use SQL this way for Data Cleaning]]></title>
            <link>https://medium.com/codex/use-sql-this-way-for-data-cleaning-c4de94057953?source=rss-c55ddde8a7b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4de94057953</guid>
            <category><![CDATA[data-cleaning]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Chitranjan Gupta]]></dc:creator>
            <pubDate>Sat, 29 Jun 2024 15:14:04 GMT</pubDate>
            <atom:updated>2024-08-09T10:32:18.777Z</atom:updated>
            <content:encoded><![CDATA[<h3>SQL is very important for Data Cleaning</h3><h4>Ensuring High-Quality Data for Analysis via SQL</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rFtVx-nlY1mkUlYiWHoJXA.png" /><figcaption>canva.com</figcaption></figure><p>When building a machine learning model or conducting a data analysis project, ensuring data quality is crucial. The principle <strong><em>“garbage in, garbage out”</em></strong> emphasizes the importance of data cleaning, which involves identifying and rectifying data inconsistencies and errors. In this tutorial, we will explore data cleaning using SQL with a simple HR database containing two tables: employees and departments.</p><h4>1. Understanding the Data</h4><p>Before we begin cleaning the data, we need to understand the structure of our database. This will help us comprehend the relationships between tables and the data types used, guiding us in our cleaning and analysis tasks.</p><h4>1.1 Show the Tables</h4><p>First, let’s display the tables in our database.</p><pre>SHOW TABLES;</pre><pre>+-----------------+<br>| Tables_in_hr_db |<br>+-----------------+<br>| departments     |<br>| employees       |<br>+-----------------+</pre><p>We have two tables in our database:<strong> ‘departments’</strong> and <strong>‘employees’</strong>.</p><h4>1.2 Describe the Tables</h4><p>Next, we’ll describe the structure of these tables to understand the columns and data types.</p><pre>DESCRIBE departments;<br>DESCRIBE employees;</pre><pre>+-----------------+-------------+------+-----+---------+-------+<br>| Field           | Type        | Null | Key | Default | Extra |<br>+-----------------+-------------+------+-----+---------+-------+<br>| department_id   | int         | NO   | PRI | NULL    |       |<br>| department_name | varchar(50) | YES  |     | NULL    |       |<br>+-----------------+-------------+------+-----+---------+-------+</pre><pre>+---------------+--------------+------+-----+---------+-------+<br>| Field         | Type         | Null | Key | Default | Extra |<br>+---------------+--------------+------+-----+---------+-------+<br>| employee_id   | int          | NO   | PRI | NULL    |       |<br>| employee_name | varchar(100) | YES  |     | NULL    |       |<br>| department_id | int          | YES  | MUL | NULL    |       |<br>| gender        | varchar(10)  | YES  |     | NULL    |       |<br>| salary        | varchar(15)  | YES  |     | NULL    |       |<br>| hire_date     | date         | YES  |     | NULL    |       |<br>+---------------+--------------+------+-----+---------+-------+</pre><p>The <strong>departments </strong>table has two columns: <strong>department_id </strong>and <strong>department_name</strong>. The <strong>employees </strong>table has six columns, including <strong>employee_id</strong>, <strong>employee_name</strong>, <strong>department_id</strong>, <strong>gender</strong>, <strong>salary</strong>, and <strong>hire_date</strong>. There is a one-to-many relationship between <strong>departments </strong>and <strong>employees</strong>.</p><h4>1.3 Retrieve the Data</h4><p>Let’s retrieve the first five rows from each table to get a sense of the data.</p><pre>SELECT * FROM departments LIMIT 5;<br>SELECT * FROM employees LIMIT 5;</pre><pre>+---------------+-----------------+<br>| department_id | department_name |<br>+---------------+-----------------+<br>|             1 | Human Resources |<br>|             2 | Marketing       |<br>|             3 | IT              |<br>+---------------+-----------------+</pre><pre>+-------------+---------------+---------------+--------+------------+------------+<br>| employee_id | employee_name | department_id | gender | salary     | hire_date  |<br>+-------------+---------------+---------------+--------+------------+------------+<br>|           1 | Sam Wilson    |             1 | M      | $62,000.00 | 2022-01-15 |<br>|           2 | Linda Jones   |             2 | Female | $78,000.00 | 2022-02-20 |<br>|           3 | Tom Hanks     |             1 | m      | $56,000.00 | 2022-03-10 |<br>|           4 | Angela White  |             3 | f      | $82,000.00 | 2022-04-05 |<br>|           5 | Peter Parker  |             2 | male   | $72,000.00 | 2022-05-12 |<br>+-------------+---------------+---------------+--------+------------+------------+</pre><p>From this sample, we can see inconsistencies in the <strong>gender </strong>column and the presence of a dollar sign in the <strong>salary </strong>column, which could complicate calculations.</p><h4>2. Cleaning the Data</h4><h4>2.1 Dealing with Duplicates</h4><p>Duplicates can distort our analysis or model, so it’s essential to identify and handle them early.</p><p>To find duplicates, we can use the <strong>ORDER BY</strong> clause for a simple approach.</p><pre>SELECT employee_name, department_id, gender, salary, hire_date <br>FROM employees <br>ORDER BY 1,2,3,4,5;<br><br>+----------------+---------------+--------+------------+------------+<br>| employee_name  | department_id | gender | salary     | hire_date  |<br>+----------------+---------------+--------+------------+------------+<br>| Angela White   |             3 | f      | $82,000.00 | 2022-04-05 |<br>| Linda Jones    |             2 | Female | $78,000.00 | 2022-02-20 |<br>| Linda Jones    |             2 | female | $78,000.00 | 2022-02-20 |<br>| Peter Parker   |             2 | male   | $72,000.00 | 2022-05-12 |<br>| Sam Wilson     |             1 | M      | $62,000.00 | 2022-01-15 |<br>| Sam Wilson     |             1 | m      | $62,000.00 | 2022-01-15 |<br>| Tom Hanks      |             1 | m      | $56,000.00 | 2022-03-10 |<br>| Tom Hanks      |             1 | M      | $56,000.00 | 2022-03-10 |<br>+----------------+---------------+--------+------------+------------+</pre><p>For a more robust approach, we can use a subquery with the <strong>COUNT </strong>function to identify duplicates.</p><pre>SELECT COUNT(*) <br>FROM(<br>  SELECT employee_name, department_id, gender, salary, hire_date, COUNT(*) as quantity<br>  FROM employees <br>  GROUP BY 1,2,3,4,5) subquery<br>WHERE quantity &gt; 1;<br><br>+----------+<br>| COUNT(*) |<br>+----------+<br>|        3 |<br>+----------+</pre><p>The above query counts the number of duplicate records. To list these duplicates, we can modify the query to include the <strong>HAVING </strong>clause.</p><pre>SELECT employee_name, department_id, gender, salary, hire_date, COUNT(*) as quantity<br>FROM employees <br>GROUP BY 1,2,3,4,5<br>HAVING quantity &gt; 1;<br><br>+---------------+---------------+--------+------------+------------+----------+<br>| employee_name | department_id | gender | salary     | hire_date  | quantity |<br>+---------------+---------------+--------+------------+------------+----------+<br>| Sam Wilson    |             1 | M      | $62,000.00 | 2022-01-15 |        2 |<br>| Linda Jones   |             2 | Female | $78,000.00 | 2022-02-20 |        2 |<br>| Tom Hanks     |             1 | m      | $56,000.00 | 2022-03-10 |        2 |<br>+---------------+---------------+--------+------------+------------+----------+</pre><p>We have found the duplicates and can now decide whether to remove, update, or retain them based on our requirements.</p><h4>2.2 Dealing with Missing Data and Nulls</h4><p>Next, we will identify records with empty strings and NULL values.</p><pre>-- Records with empty strings<br>SELECT * FROM employees WHERE gender = &#39;&#39;;<br><br>-- Records with null values<br>SELECT * FROM employees <br>WHERE <br>employee_name IS NULL OR<br>department_id IS NULL OR<br>gender IS NULL OR<br>salary IS NULL OR<br>hire_date IS NULL;<br><br>+-------------+---------------+---------------+--------+------------+------------+<br>| employee_id | employee_name | department_id | gender | salary     | hire_date  |<br>+-------------+---------------+---------------+--------+------------+------------+<br>|           6 | Emma Brown    |             3 |        | $74,000.00 | 2022-06-18 |<br>+-------------+---------------+---------------+--------+------------+------------+<br><br>+-------------+---------------+---------------+--------+------------+------------+<br>| employee_id | employee_name | department_id | gender | salary     | hire_date  |<br>+-------------+---------------+---------------+--------+------------+------------+<br>|           8 | Jake Green    |             2 | NULL   | $68,000.00 | 2022-08-30 |<br>|           9 | Nick Blue     |          NULL | F      | $62,000.00 | 2022-09-05 |<br>+-------------+---------------+---------------+--------+------------+------------+</pre><p>We found one record with an empty string in the <strong>gender </strong>column and two with NULL values. Depending on our dataset and requirements, we can handle missing data by filling it with the average, median, mode, or replacing it with a constant value.</p><p>Suppose we know that Jake Green is male; we can update his gender using a <strong>CASE </strong>statement.</p><pre>SELECT employee_id, employee_name, department_id, salary, hire_date,<br>CASE WHEN gender IS NULL THEN &#39;M&#39; END AS gender<br>FROM employees<br>WHERE employee_id = 8;</pre><p>If NULL values are expected, we can use the <strong>COALESCE </strong>function to display a default value.</p><h4>2.3 Correcting Categorical Data</h4><p>The <strong>gender </strong>column contains inconsistent values like <strong>Female</strong>, <strong>F</strong>, <strong>f</strong>, etc. To ensure data quality, we need to standardize these values. First, let&#39;s print all distinct values in the <strong>gender </strong>column.</p><pre>SELECT DISTINCT UPPER(gender) AS gender FROM employees;<br><br>+--------+<br>| gender |<br>+--------+<br>| M      |<br>| FEMALE |<br>| F      |<br>| MALE   |<br>|        |<br>| NULL   |<br>+--------+</pre><p>Now, we will replace these values with <strong>m </strong>for males and <strong>f </strong>for females.</p><pre>SELECT employee_id, employee_name, department_id, salary, hire_date, <br>CASE <br>WHEN UPPER(gender) IN (&#39;M&#39;,&#39;MALE&#39;) THEN &#39;m&#39;<br>WHEN UPPER(gender) IN (&#39;FEMALE&#39;,&#39;F&#39;) THEN &#39;f&#39;<br>ELSE &#39;&#39; END AS gender<br>FROM employees;<br><br>+-------------+---------------+---------------+------------+------------+--------+<br>| employee_id | employee_name | department_id | salary     | hire_date  | gender |<br>+-------------+---------------+---------------+------------+------------+--------+<br>|           1 | Sam Wilson    |             1 | $62,000.00 | 2022-01-15 | m      |<br>|           2 | Linda Jones   |             2 | $78,000.00 | 2022-02-20 | f      |<br>|           3 | Tom Hanks     |             1 | $56,000.00 | 2022-03-10 | m      |<br>|           4 | Angela White  |             3 | $82,000.00 | 2022-04-05 | f      |<br>|           5 | Peter Parker  |             2 | $72,000.00 | 2022-05-12 | m      |<br>|           6 | Emma Brown    |             3 | $74,000.00 | 2022-06-18 |        |<br>|           7 | Sophia Black  |             1 | $70,000.00 | 2022-07-25 | f      |<br>|           8 | Jake Green    |             2 | $68,000.00 | 2022-08-30 |        |<br>|           9 | Nick Blue     |          NULL | $62,000.00 | 2022-09-05 | f      |<br>|          10 | Sam Wilson    |             1 | $62,000.00 | 2022-01-15 | m      |<br>|          11 | Linda Jones   |             2 | $78,000.00 | 2022-02-20 | f      |<br>|          12 | Tom Hanks     |             1 | $56,000.00 | 2022-03-10 | m      |<br>|          13 | Mark Brown    |             3 | $80,000.00 | 2050-05-10 | m      |<br>+-------------+---------------+---------------+------------+------------+--------+</pre><p>We also notice an employee, Mark Brown, with a hire date in the future (2050–05–10). Let’s correct it using a <strong>CASE </strong>clause.</p><h4>2.4 Type Conversion</h4><p>The <strong>salary </strong>column contains a dollar sign, which can hinder calculations. To calculate the average salary by department, we need to remove the dollar sign and cast the data type to decimal.</p><p>First, let’s attempt a query without cleaning the <strong>salary </strong>column.</p><pre>SELECT department_name, AVG(salary) as &quot;Average Salary&quot;<br>FROM employees LEFT JOIN departments<br>ON employees.department_id = departments.department_id<br>GROUP BY department_name;<br><br>+-----------------+----------------+<br>| department_name | Average Salary |<br>+-----------------+----------------+<br>| Human Resources |              0 |<br>| Marketing       |              0 |<br>| IT              |              0 |<br>+-----------------+----------------+</pre><p>The average salary is zero because of the dollar sign. Let’s fix this.</p><pre>SELECT department_name, <br>AVG(<br>CAST(REPLACE(salary, &#39;$&#39;, &#39;&#39;) AS DECIMAL(10,2))<br>) AS &quot;Average Salary&quot;<br>FROM employees LEFT JOIN departments<br>ON employees.department_id = departments.department_id<br>GROUP BY department_name;<br><br>+-----------------+----------------+<br>| department_name | Average Salary |<br>+-----------------+----------------+<br>| Human Resources |      60.000000 |<br>| Marketing       |      71.500000 |<br>| IT              |      78.666667 |<br>+-----------------+----------------+</pre><p>The salary column is now correctly formatted and can be used for calculations.</p><h3>3. Final Thoughts and Bonus</h3><p>This tutorial provides an introduction to data cleaning with SQL, a critical step for any data project. Effective data cleaning requires understanding your data, identifying issues, and applying appropriate cleaning techniques. The best way to improve your data cleaning skills is through practice and engaging</p><p><strong>BONUS</strong></p><p>For further learning of data cleaning techniques, below points should help you for your roadmap.</p><ol><li><strong>Data Normalization:</strong> Implement and understand normalization techniques to prevent redundancy.</li><li><strong>Regular Expressions:</strong> Using regex for complex data cleaning tasks.</li><li><strong>Automation:</strong> Develop scripts or use tools like Python’s Pandas for automated cleaning.</li><li><strong>Projects and Case Studies:</strong> Work on real-world datasets to apply and refine your skills. Join communities and participate in data cleaning challenges.</li></ol><h4>More Related Articles</h4><p><a href="https://medium.com/codex/data-cleaning-using-pandas-c65e20a84c4b">Data Cleaning using Pandas</a></p><p>Feel free to show your support with Claps and Follow me for more articles on Data Science techniques. Thank you!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4de94057953" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codex/use-sql-this-way-for-data-cleaning-c4de94057953">Use SQL this way for Data Cleaning</a> was originally published in <a href="https://medium.com/codex">CodeX</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Cleaning using Pandas]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/codex/data-cleaning-using-pandas-c65e20a84c4b?source=rss-c55ddde8a7b3------2"><img src="https://cdn-images-1.medium.com/max/1200/1*YFqtFtrOaXm02FTSeZ9pjA.png" width="1200"></a></p><p class="medium-feed-snippet">A Beginner level methods to clean messy data.</p><p class="medium-feed-link"><a href="https://medium.com/codex/data-cleaning-using-pandas-c65e20a84c4b?source=rss-c55ddde8a7b3------2">Continue reading on CodeX »</a></p></div>]]></description>
            <link>https://medium.com/codex/data-cleaning-using-pandas-c65e20a84c4b?source=rss-c55ddde8a7b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/c65e20a84c4b</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[clean-data]]></category>
            <category><![CDATA[data-cleaning]]></category>
            <dc:creator><![CDATA[Chitranjan Gupta]]></dc:creator>
            <pubDate>Sat, 16 Sep 2023 18:24:13 GMT</pubDate>
            <atom:updated>2024-08-17T23:26:31.748Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to learn Statistics]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/codex/learn-statistics-for-data-science-f35e5e65668f?source=rss-c55ddde8a7b3------2"><img src="https://cdn-images-1.medium.com/max/1920/1*F11_x0CPngOdqO7xRXBX4w.png" width="1920"></a></p><p class="medium-feed-snippet">A quick yet complete roadmap to work on your Statistics skills &#x1F44F;&#x1F44F;</p><p class="medium-feed-link"><a href="https://medium.com/codex/learn-statistics-for-data-science-f35e5e65668f?source=rss-c55ddde8a7b3------2">Continue reading on CodeX »</a></p></div>]]></description>
            <link>https://medium.com/codex/learn-statistics-for-data-science-f35e5e65668f?source=rss-c55ddde8a7b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/f35e5e65668f</guid>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[statistics]]></category>
            <dc:creator><![CDATA[Chitranjan Gupta]]></dc:creator>
            <pubDate>Wed, 22 Jun 2022 04:36:05 GMT</pubDate>
            <atom:updated>2026-05-11T15:46:36.417Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Life-Cycle of a Data Analytics Project]]></title>
            <link>https://medium.com/codex/life-cycle-of-a-data-analytics-project-954d0e6926fe?source=rss-c55ddde8a7b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/954d0e6926fe</guid>
            <category><![CDATA[data-analyst]]></category>
            <category><![CDATA[lifecycle]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[google-data-analytics]]></category>
            <dc:creator><![CDATA[Chitranjan Gupta]]></dc:creator>
            <pubDate>Wed, 15 Jun 2022 09:42:18 GMT</pubDate>
            <atom:updated>2022-07-03T04:47:08.060Z</atom:updated>
            <content:encoded><![CDATA[<h3>Work on your next Data Analytics project in 6 steps</h3><p><strong><em>Learnings from Google Data Analytics Program</em></strong></p><p>When working on data analytics projects, there are some fixed tasks that must be completed in order to achieve the desired results. So, in this section, we will create a data analytics project cycle, which will be a set of standard data-driven processes for effectively leading data to insights. A project’s life cycle defines data analytics processes should be followed by sequences for effectively achieving the goal using input datasets. Identifying data analytics problems, designing and collecting datasets, data analytics, and data visualization are all part of the data analytics process.</p><p>The data analysis process consists of six steps: <strong><em>ask, prepare, process, analyze, share, </em></strong>and<strong><em> act</em></strong>. These six steps are applicable to any type of data analysis. Continue reading to find out how a group of people analysts used these six steps to solve a business problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4h7ahFBqnaFHeWibHWOl7w.png" /></figure><p>A company was experiencing high turnover among new hires. Many employees quit before the end of their first year at the company. The data analysis process was used by the analysts to answer the following question:</p><blockquote><strong>how can the organization improve the retention rate for new employees?</strong></blockquote><p>Here’s a step-by-step breakdown of what this team accomplished.</p><h3><strong>1. Ask</strong></h3><p>First and foremost, the analysts needed to define what the project would entail and what would constitute a successful outcome. As a result, they asked effective questions and collaborated with leaders and managers who were interested in the outcome of their people analysis to determine these things.</p><p>They asked the following types of questions:</p><ul><li>What do you think new employees need to learn to be successful in their first year on the job?</li><li>Have you gathered data from new employees before? If so, may we have access to the historical data?</li><li>Do you believe managers with higher retention rates offer new employees something extra or unique?</li><li>What do you suspect is a leading cause of dissatisfaction among new employees?</li><li>By what percentage would you like employee retention to increase in the next fiscal year?</li></ul><h3>2. Prepare</h3><p>It all started with careful planning. The group established a three-month timeline and decided how they would communicate their progress to interested parties. During this step, the analysts also determined what data they required to achieve the successful outcome identified in the previous step; in this case, the analysts chose to collect the data from an online survey of new employees. They prepared by doing the following:</p><ul><li>They developed specific questions to ask about employee satisfaction with different business processes, such as hiring and onboarding, and their overall compensation.</li><li>They established rules for who would have access to the data collected — in this case, anyone outside the group wouldn’t have access to the raw data, but could view summarized or aggregated data. For example, an individual’s compensation wouldn’t be available, but salary ranges for groups of individuals would be viewable.</li><li>They finalized what specific information would be gathered, and how best to present the data visually. The analysts brainstormed possible project- and data-related issues and how to avoid them.</li></ul><h3>3. Process</h3><p>The survey was distributed by the group. Great analysts understand how to respect their data as well as the people who provide it. Because employees provided the data, it was critical that all employees gave their consent to participate. The data analysts also ensured that employees were aware of how their data would be collected, stored, managed, and safeguarded. They took the following steps to maintain confidentiality and effectively protect and store the data:</p><ul><li>They restricted access to the data to a limited number of analysts.</li><li>They cleaned the data to make sure it was complete, correct, and relevant. Certain data was aggregated and summarized without revealing individual responses.</li><li>They uploaded raw data to an internal data warehouse for an additional layer of security.</li></ul><h3>4. Analyze</h3><p>The analysts then did what they do best: they analyzed! The data analysts discovered that an employee’s experience with certain processes was a key indicator of overall job satisfaction based on the completed surveys. These were their findings:</p><ul><li>Employees who experienced a long and complicated hiring process were most likely to leave the company.</li><li>Employees who experienced an efficient and transparent evaluation and feedback process were most likely to remain with the company.</li></ul><h3>5. Share</h3><p>The analysts were as cautious in sharing the report as they were in protecting the data. They presented their findings in the following manner:</p><ul><li>They shared the report with managers who met or exceeded the minimum number of direct reports with submitted responses to the survey.</li><li>They presented the results to the managers to make sure they had the full picture.</li><li>They asked the managers to personally deliver the results to their teams.</li></ul><p>This process gave managers an opportunity to communicate the results with the right context. As a result, they could have productive team conversations about next steps to improve employee engagement.</p><h3>6. Act</h3><p>The team of analysts’ final stage of the process was to collaborate with company leaders to determine how best to implement changes and take actions based on the findings. Their recommendations were as follows:</p><ul><li>Standardize the hiring and evaluation process for employees based on the most efficient and transparent practices.</li><li>Conduct the same survey annually and compare results with those from the previous year.</li></ul><p>The same survey was distributed to employees a year later. Analysts predicted that a comparison of the two sets of results would show that the action plan was effective. As it turns out, the changes improved new employee retention, and leaders’ actions were successful!</p><h3><strong><em>Data + business knowledge = mystery solved</em></strong></h3><p>Blending data with business knowledge, plus maybe a touch of gut instinct, will be a common part of your process as a junior data analyst. The key is figuring out the exact mix for each particular project. A lot of times, it will depend on the goals of your analysis. That is why analysts often ask, “How do I define success for this project?”</p><p>In addition, try asking yourself these questions about a project to help find the perfect balance:</p><ul><li>What kind of results are needed?</li><li>Who will be informed?</li><li>Am I answering the question being asked?</li><li>How quickly does a decision need to be made?</li></ul><p><strong>Thank you!</strong></p><p>This is my first article, and I wanted to start good. You can reach out to me here.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=954d0e6926fe" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codex/life-cycle-of-a-data-analytics-project-954d0e6926fe">Life-Cycle of a Data Analytics Project</a> was originally published in <a href="https://medium.com/codex">CodeX</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>