<?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 Aden Mukhtar on Medium]]></title>
        <description><![CDATA[Stories by Aden Mukhtar on Medium]]></description>
        <link>https://medium.com/@adenmukhtar?source=rss-9fd233fad881------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ebrOJhBJwZD0vImy.jpg</url>
            <title>Stories by Aden Mukhtar on Medium</title>
            <link>https://medium.com/@adenmukhtar?source=rss-9fd233fad881------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 20:52:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adenmukhtar/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[An Introduction to Pandas]]></title>
            <link>https://medium.com/@adenmukhtar/an-introduction-to-pandas-150f0b7202c?source=rss-9fd233fad881------2</link>
            <guid isPermaLink="false">https://medium.com/p/150f0b7202c</guid>
            <dc:creator><![CDATA[Aden Mukhtar]]></dc:creator>
            <pubDate>Sun, 05 Feb 2023 17:07:41 GMT</pubDate>
            <atom:updated>2023-02-05T17:07:41.400Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*crmBmr5sXOkj44ZNzZY2fw.jpeg" /></figure><p>Pandas is a fast and powerful open-source python library for data manipulation, analysis, and visualization. It provides you with the ability to perform operations for manipulating and visualizing large and complex data sets.</p><p>You can start by importing the dataset. After that, you can use different methods like plot ( ) and mean( ) that the package provides to visualize and manipulate the data.</p><p>Once you have completed working on the data you can export the data to a new file. This article will cover some of the basic operations you can perform on data using Pandas.</p><h3>Table of Contents</h3><blockquote><a href="#8a56">Data Structures</a></blockquote><blockquote><a href="#20ce">Features of Pandas</a></blockquote><blockquote><a href="#2a38">Working on Data</a></blockquote><blockquote><a href="#eeda">Performing Different operations on Data</a></blockquote><blockquote><a href="#d34b">Visualizing Data</a></blockquote><blockquote><a href="#cd76">Exporting the dataset to a new CSV file</a></blockquote><blockquote><a href="#893d">Conclusion</a></blockquote><h3>Data Structures</h3><p>There are two data structures in Pandas namely:</p><ol><li>Series</li><li>DataFrame</li></ol><h3>Series</h3><p>A series is similar to a column in a spreadsheet, or a python list. A series is a one-dimensional array that can hold any data type.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a865145cb2777dff25e784a9d43c0ff5/href">https://medium.com/media/a865145cb2777dff25e784a9d43c0ff5/href</a></iframe><h3>DataFrame</h3><p>DataFrame is a two-dimensional data structure with rows and columns. Each column can be of a different data type.</p><pre># You can combine the Series of cars and colours to make a DataFrame<br>car_data = pd.DataFrame({&quot;Car Make&quot;: cars, &quot;Colour&quot;: colours})</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f6bfd60fd39a2c82cc3d422788e120a/href">https://medium.com/media/0f6bfd60fd39a2c82cc3d422788e120a/href</a></iframe><h3>Features of Pandas</h3><p>There are many different features that Pandas offers us. We will discuss some of the key features.</p><ul><li><strong>Data Cleaning</strong>: You can clean data by handling the missing values and the duplicate values. For example, you can drop the missing and duplicate values.</li><li><strong>Data Transformation:</strong> You can transform raw data into a more suitable format or structure.</li><li><strong>Data Analysis:</strong> You can perform the data analysis on the data by using functions like merge, reshape, join, and concatenate data.</li><li><strong>Data Visualization:</strong> Pandas provides you with the ability to visualize your data in the forms of plots such as bar graphs, plots, histograms, area plots, and scatter plots.</li></ul><h3>Working on Data in Pandas</h3><p>Now as you have got a basic idea of what Pandas can do we will demonstrate to you how to work on data in Pandas starting with importing pandas in your python script.</p><h3>Importing Pandas</h3><p>Once you have installed pandas you can import it into your python script using the following line of code.</p><pre>import pandas as pd</pre><h3>Reading or Importing a CSV file</h3><p>After successfully importing the next step is to read or import a CSV file by using the following line of code.</p><pre># You can import the the data from the file &quot;car-sales.csv&quot;<br>car_sales = pd.read_csv(&quot;car-sales.csv&quot;)</pre><p>Here in the line of code above car_sales is the name of the variable and “car-sales.csv” is the name of the file.</p><h3>Performing different operations on the data</h3><p>Once you have imported the data set you can perform different operations on your data like data cleaning, data transformation, data analysis, and visualization.</p><h3>Viewing the Data set</h3><p>You can view the data set by running the following line of code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/395a9612817b7acb2c9ead4e809de90d/href">https://medium.com/media/395a9612817b7acb2c9ead4e809de90d/href</a></iframe><h4>head( ) and tail( )</h4><p>You can view the top five rows of your data set by using the head( ) method. Similarly, you can view the last five rows of your data set using the tail( ) method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0db9ed60c12ebf060d7481e032a086d5/href">https://medium.com/media/0db9ed60c12ebf060d7481e032a086d5/href</a></iframe><p>You can enter the number of rows you want to display in the head( ) and the tail( ) methods. For example, to display the first two rows you can write the following line of code.</p><pre>car_sales.head(2)</pre><h3>Handling the Missing Values</h3><p>There are various methods of handling the missing values in your data. For example, you can drop the missing values using the dropna( ) method or you can fill in the missing values by using the fillna( ) method.</p><p>Here we will show you a dataset with missing values.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8b92a8309532c1082290622a435fbd6/href">https://medium.com/media/a8b92a8309532c1082290622a435fbd6/href</a></iframe><p>As you can see the data set above has missing values. You can handle the missing values using the fillna( ) and the dropna( ) methods as described below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/51de8154d1b2f2918bebc5c3d7d8868f/href">https://medium.com/media/51de8154d1b2f2918bebc5c3d7d8868f/href</a></iframe><p>You can see we used the fillna( ) method to fill the “Odometer” column using the mean of the “Odometer” column. Or you can completely drop the rows with the missing values using the dropna( ) method.</p><h3>Drop Duplicates:</h3><p>You can drop duplicate rows using the drop_duplicates( ) method on the data set.</p><pre>car_sales_data.drop_duplicates()</pre><h3>Converting data types</h3><p>Sometimes while preparing your data set for data analysis you have to change the datatypes you can do so by using the astype() method.</p><p>To understand this concept let&#39;s go back to our car_sales data.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/293164d5af82dadd531611faf88f8770/href">https://medium.com/media/293164d5af82dadd531611faf88f8770/href</a></iframe><p>With the original “Price” column in the car_sales data set, we can not perform mathematical operations on the data. But after changing it to an integer type using the astype( ) method you can perform anymathematical operation.</p><h3>Adding a Column</h3><p>You can add a new column to the data set by different methods we will show you some of the methods here. You can make a new column by making it equal to a single value, a pandas series, or a python list.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/91dc656e0d71d0a9909e5ca1c85fe72a/href">https://medium.com/media/91dc656e0d71d0a9909e5ca1c85fe72a/href</a></iframe><h3>Shuffling the data</h3><p>You can use the sample( ) method to shuffle the rows from their original order or get a fraction of the shuffled data.</p><p>We will consider the example of our car_sales data to understand the sample( ) method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d285a09f3b14f1ddad0f608eb41cf9b1/href">https://medium.com/media/d285a09f3b14f1ddad0f608eb41cf9b1/href</a></iframe><h3>Data Visualization</h3><p>Pandas library gives you the ability to visualize your data by using methods like plot(), and hist().</p><p>We will show you the plots for the “Odometer (KM)” and “Price” columns, and the histogram for the “Odometer (KM)” column.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/16593490b432edc874d197563cdfb843/href">https://medium.com/media/16593490b432edc874d197563cdfb843/href</a></iframe><h3>Exporting the dataset to a new CSV file</h3><p>After working with data you can export the data to a new CSV file by using the to_csv() method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/16b5c27abc1c40155477c7aab057df90/href">https://medium.com/media/16b5c27abc1c40155477c7aab057df90/href</a></iframe><h3>Conclusion</h3><p>Now we have covered all the basic operations you can perform for data analysis and manipulation using the Pandas library. You can do a lot more than we have covered in this article using pandas.</p><p>If you want to learn more about pandas you can refer to the <a href="https://pandas.pydata.org/docs/">official pandas documentation</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=150f0b7202c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>