<?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 Ihsjxhhan BT on Medium]]></title>
        <description><![CDATA[Stories by Ihsjxhhan BT on Medium]]></description>
        <link>https://medium.com/@ahsanrabbi?source=rss-c8bcf3d0a0c9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*P8t6iUUdHaZHWuRp2Uy3qQ.jpeg</url>
            <title>Stories by Ihsjxhhan BT on Medium</title>
            <link>https://medium.com/@ahsanrabbi?source=rss-c8bcf3d0a0c9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 12:30:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ahsanrabbi/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[Data Cleaning 101: Removing Null Values for Effective Data Analysis]]></title>
            <link>https://medium.com/@ahsanrabbi/data-cleaning-101-removing-null-values-for-effective-data-analysis-a2b2009c0b4f?source=rss-c8bcf3d0a0c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2b2009c0b4f</guid>
            <dc:creator><![CDATA[Ihsjxhhan BT]]></dc:creator>
            <pubDate>Wed, 25 Oct 2023 09:30:43 GMT</pubDate>
            <atom:updated>2023-12-04T07:49:49.112Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XPFvMjs9ACIoKZExoIhvWA.jpeg" /></figure><p>Data cleaning is one of the prime and foremost steps to perform in order to develop a robust model for machine learning. The data quality reflects over the performance, accuracy and effectiveness of the Machine Learning models. To do the cleaning, we need to understand the issues in the raw data for better data analysis. There are different stages for cleaning the data, here the focus is on removing the null values from the data.</p><p>It is normal to have a dataset with null values. Null values are the missing information or data in a cell, row or column. These are represented by NAN, NA or blank spaces. You will consider yourself lucky if you haven’t found any null value in your dataset. Otherwise, data analysts have to use different scientific methods and, sometimes, judgemental decisions to remove the null values or replace those with suitable values in order to safeguard the true spirit of the dataset. Here, being judgemental does not mean to handle missing values with a hunch or gut feeling without considering the dataset. Data analyst have to consider different factors like nature of data, structure of data, significance of the information and the ultimate purpose of the data. After that, data analyst can make a judgement to fill null values with the appropriate ones.</p><p><strong>Impact of Missing Values</strong></p><p>Before going further, first take a brief understanding about the significance of the missing information in the data analysis and result. When we perform statistical description like mean, median, mode, sum or even standard deviation, the missing data is considered as zero. This may lead to biased and unreliable result. Some ML models can’t handle null values and give inaccurate result. Therefore, it is better to resolve it in order to develop a strong and effective data analysis and ML model.</p><p>Let’s find out some of the basic codes to deal with null values:</p><p><strong>Importing Libraries &amp; Data Frame</strong></p><p>We need to import two libraries: ‘pandas’ for data analysis and manipulation whereas ‘numpy’ for Algebraic and scientific computation.</p><pre>import pandas as pd<br>import numpy as np</pre><p><strong>Loading Data Frame</strong></p><pre>df = pd.read_csv(‘./data.csv’)</pre><p>Here, `df` is the demotion of data frame, `csv` the file type and `data` the file name</p><p><strong>Identification of Null Values</strong></p><pre>df.isnull().sum() #Identification of the null values in each column<br>df.isnull().sum().sum() # Sum of all null values in data frame</pre><p><strong>Filling Null Values with “0”</strong></p><pre>df.fillna(value = 0) # filling all null values equal to zero</pre><p><strong>Filling Null Values with Previous Value</strong></p><p>This method can be used if we have time-series data and the previous value of the column can be considered to fill the null value.</p><pre>df.fillna(method = ‘pad’) # filling Null values with that of previous row value</pre><p>Similarly, we can also fill the data from the next value in a column.</p><pre>df.fillna(method = ‘bfill’) # filling Null values with that of next row value</pre><p><strong>Filling Null Values with Mean</strong></p><p>This strategy is used by the analyst to keep the data unchanged from the null values by replacing those with that of mean value of that respective column.</p><pre>df.fillna(value = df[‘Column Name’].mean()) #filling null values with the mean of that column.</pre><p>You can also replace with the minimum value of that column.</p><pre>df.fillna(value = df[‘Column Name’].min())</pre><p><strong>Dropping the Column or Row</strong></p><p>This method is used when there are significant missing values in a particular column and that column is not important for the study.</p><pre>df.drop(columns = “Column Name”) #Dropping the column containing high null values</pre><p>Here, `Column Name` is the name of that particular column.</p><pre>df.dropna() #Dropping all those rows containing null value<br>df.dropna(how=&#39;all&#39;) #Dropping only those rows having null values in each cells</pre><p><strong>Replacement of Null Values</strong></p><p>Sometimes, data analyst wants to replace the missing values with the particular number / string. This is the beauty of python to fill missing values in a big data using a simple code.</p><pre>df.replace(to_replace=np.nan, value=123) # replace all the Null values in the dataset with &quot;123&quot;.</pre><p>If you want to replace 3.0 in the data with 5.0 in Column A then we can use below code:</p><pre>df[&#39;Column A&#39;].replace(to_replace=3.0, value=5.0) #Replacement of 3.0 value with 5.0 only in Column A</pre><p><strong>Interpolating Missing Value</strong></p><p>We can also use the interpolate function to replace the missing values by using linear method. This method is used by the analysts to replace the missing values by keeping the trend of the data linearly.</p><pre>df[‘Column A’].interpolate(method=’linear’)</pre><p><strong>Final Words</strong></p><p>Dealing with real-life, raw and big data often presents the challenge of missing information, which can have significant impact on the precision and reliability of our data analysis and findings. It is essential for the researchers to comprehend the various categories of missing data and deal with it. Each approach for managing missing data has its own strengths and weaknesses and should be chosen based on the specific nature of the data. Here, some of the basic methods are presented to handle the missing values. However, these codes can help you to develop more advanced codes to better deal with the missing values based upon the data requirements.</p><p><strong>Written by Muhammad Ahsan Rabbi</strong></p><p><strong>Data Analyst | Data Scientist | virtual Researcher</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2b2009c0b4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>