

{"id":22042,"date":"2018-07-20T04:00:01","date_gmt":"2018-07-20T04:00:01","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=22042"},"modified":"2026-04-28T14:54:43","modified_gmt":"2026-04-28T09:24:43","slug":"pandas-tutorial","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/","title":{"rendered":"Python Pandas Tutorial &#8211; Learn Pandas in Python"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:1540,&quot;href&quot;:&quot;https:\\\/\\\/pandas.pydata.org&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251011085401\\\/https:\\\/\\\/pandas.pydata.org\\\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 10:37:21&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-14 09:06:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-17 13:11:54&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-22 09:38:20&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-26 15:42:58&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-31 04:38:39&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-03 08:59:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-12 11:59:57&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-16 05:20:35&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-19 06:17:51&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-25 05:47:20&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-28 21:00:54&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-01 16:46:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-05 08:01:25&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-08 20:28:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-12 06:32:33&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-15 18:25:52&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-19 10:19:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-22 14:14:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-26 04:22:39&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-01 14:08:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-08 08:27:46&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-11 10:12:26&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-15 07:27:01&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-20 02:49:08&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-24 09:19:58&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-27 12:26:52&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-31 01:25:42&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-03 14:06:54&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-07 00:07:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-11 11:43:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-15 18:53:40&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-20 10:50:54&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-24 09:51:42&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-28 11:57:30&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-03 06:29:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-06 13:23:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-11 05:43:59&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-16 04:55:23&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-19 18:47:29&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-23 07:25:52&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-26 11:38:14&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-01 05:03:03&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-01 05:03:03&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p><span style=\"font-weight: 400\">In our last <a href=\"https:\/\/data-flair.training\/blogs\/python-library\/\"><strong>Python Library<\/strong><\/a> tutorial, we discussed <a href=\"https:\/\/data-flair.training\/blogs\/scipy-tutorial\/\"><strong>Python Scipy<\/strong><\/a>. Today, we will look at a Python Pandas Tutorial. In this Pandas tutorial, we will learn the exact meaning of Pandas in <em>Python<\/em>. Moreover, we will see the features, installation, and dataset in Pandas. Along with this, we will discuss Pandas data frames and how to manipulate the dataset in Python Pandas. Also, we will discuss Pandas examples and some terms, such as ranking, series, and panels.<\/span><\/p>\n<p>So, let&#8217;s start the Python Pandas Tutorial.<\/p>\n<div id=\"attachment_22105\" style=\"width: 1210px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Pandas-Tutorial-01.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22105\" class=\"wp-image-22105 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Pandas-Tutorial-01.jpg\" alt=\"Python pandas tutorial\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Pandas-Tutorial-01.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Pandas-Tutorial-01-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Pandas-Tutorial-01-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Pandas-Tutorial-01-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Pandas-Tutorial-01-1024x536.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><p id=\"caption-attachment-22105\" class=\"wp-caption-text\">Python Pandas Tutorial 2018 | Learn Pandas in Python<\/p><\/div>\n<h3>What is Pandas in Python?<\/h3>\n<p><span style=\"font-weight: 400\">As discussed above, you can use pandas to manipulate and analyze data. With the data structures and operations it has to offer, you can play around with time series and numerical tables.<\/span><\/p>\n<div id=\"attachment_22045\" style=\"width: 610px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/pandas-5.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22045\" class=\"wp-image-22045 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/pandas-5.png\" alt=\"Python Pandas Tutorial\" width=\"600\" height=\"125\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/pandas-5.png 600w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/pandas-5-150x31.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/pandas-5-300x63.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><p id=\"caption-attachment-22045\" class=\"wp-caption-text\">Python Pandas Tutorial<\/p><\/div>\n<p><span style=\"font-weight: 400\">Let\u2019s take a look at some bullet points about this-<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"><strong>Author:<\/strong> Wes McKinney<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"><strong>First Release:<\/strong> version 0.23.2; July, 2018<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"><strong>Written in:<\/strong> Python<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Pandas is under a three-clause BSD license and is free to download, use, and distribute. Etymologically, the term is a portmanteau of the words \u201cpanel\u201d and \u201cdata\u201d. What this means is that you need to supervise data sets multiple times for one individual.<\/span><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-multiple-inheritance\/\">Do you know about Python Multiple Inheritance<\/a>?<\/strong><\/p>\n<p><strong>Benefits of using pandas:<\/strong><\/p>\n<ul>\n<li><strong>Organised tables:<\/strong> It lets you work in a dataframe, which looks the same as a spreadsheet.<\/li>\n<li><strong>Fast and powerful:<\/strong> It can process a vast amount of data at a time.<\/li>\n<li><strong>Easy cleaning:<\/strong> It has commands like one click, which help in fixing the errors easily.<\/li>\n<li><strong>Works with others:<\/strong> It helps in directly connecting with the tools used to make charts and AI models.<\/li>\n<\/ul>\n<h3>Python Pandas Features<\/h3>\n<p><strong>Here, in this Python pandas Tutorial, we are discussing some Pandas features:<\/strong><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Inserting and deleting columns in data structures.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Merging and joining data sets.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Reshaping and pivoting data sets.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Aligning data and dealing with missing data.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Manipulating data using integrated indexing for DataFrame objects.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Performing split-apply-combine on data sets using the group-by engine.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Manipulating high-dimensional data in a data structure with a lower dimension using hierarchical axis indexing.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Subsetting, fancy indexing, and label-based slicing data sets that are large in size.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Generating data range, converting frequency, date shifting, lagging, and other time-series functionality.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Reading from files with CSV, XLSX, TXT, and other formats.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Arranging data in an ascending or descending order.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Filtering data around a condition.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Analyzing time series.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Iterating over a data set.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">With Python Pandas, it is easier to clean and wrangle your data. Pandas Features like these make it a great choice for data science and analysis. Using it with libraries like NumPy and <strong><a href=\"https:\/\/data-flair.training\/blogs\/python-matplotlib-tutorial\/\">Matplotlib <\/a><\/strong>makes it all the more useful.<\/span><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-numpy-tutorial\/\">Do you know about NumPy, a Python Library<\/a><\/strong><\/p>\n<h3>How to Install Pandas?<\/h3>\n<p><strong>Below are the steps to install Pandas in Python:<\/strong><\/p>\n<h4><strong>a. Installing Pandas<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">To install pandas, you can use pip-<\/span><\/p>\n<p><span style=\"font-weight: 400\">pip install pandas<\/span><\/p>\n<p><strong>b. Importing Pandas<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Now let\u2019s import this using an alias-<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt;import pandas as pd<\/pre>\n<p><span style=\"font-family: Verdana, Geneva, sans-serif\">This lets us enjoy the liberty of mentioning pandas as <\/span>pd<span style=\"font-family: Verdana, Geneva, sans-serif\">.<\/span><\/p>\n<h4><strong>c. Importing a Dataset<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">You can use the function read_csv() to make it read a CSV file. Let\u2019s import the furniture dataset.<\/span><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-data-file-formats\/\">Let&#8217;s discuss Python File Format<\/a><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture=pd.read_csv('furniture.csv')\r\n&gt;&gt;&gt; furniture<\/pre>\n<div id=\"attachment_22046\" style=\"width: 399px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/changing-data-type.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22046\" class=\"wp-image-22046 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/changing-data-type.png\" alt=\"Python Pandas\" width=\"389\" height=\"115\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/changing-data-type.png 389w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/changing-data-type-150x44.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/changing-data-type-300x89.png 300w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/a><p id=\"caption-attachment-22046\" class=\"wp-caption-text\">Python Pandas Tutorial &#8211; Importing a Dataset in Pandas<\/p><\/div>\n<h3>Dataset in Pandas<\/h3>\n<p><strong>Following are the Pandas datasets, let&#8217;s discuss them in detail:<\/strong><\/p>\n<h4><strong>a. Column names<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">The following command will give us all the column names-<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.columns<\/pre>\n<p><strong>Index([&#8216;Unnamed: 0&#8217;, &#8216;Product&#8217;, &#8216;Brand&#8217;, &#8216;Cost&#8217;], dtype=&#8217;object&#8217;)<\/strong><br \/>\n<span style=\"font-weight: 400\">We can slice it-<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.columns[0:2]<\/pre>\n<p><strong>Index([&#8216;Unnamed: 0&#8217;, &#8216;Product&#8217;], dtype=&#8217;object&#8217;)<\/strong><\/p>\n<h4><strong>b. Data types<\/strong><\/h4>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.dtypes<\/pre>\n<p><strong>Unnamed: 0 \u00a0\u00a0\u00a0\u00a0int64<\/strong><br \/>\n<strong>Product \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0object<\/strong><br \/>\n<strong>Brand \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0object<\/strong><br \/>\n<strong>Cost \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0int64<\/strong><br \/>\n<strong>dtype: object<\/strong><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-namedtuple\/\">Read Python namedtuple\u00a0<\/a><\/strong><br \/>\n<span style=\"font-weight: 400\">To find out more about data types, read up on NumPy with Python. Let\u2019s find out the data types of one column.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture['Brand'].dtypes<\/pre>\n<p><strong>dtype(&#8216;O&#8217;)<\/strong><br \/>\n<span style=\"font-weight: 400\">O denotes an object.<\/span><\/p>\n<h4><strong>c. Shape<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">To find out what shape your data set is, you can use the shape tuple-<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.shape<\/pre>\n<p><strong>(5, 4)<\/strong><br \/>\n<span style=\"font-weight: 400\">Number of rows-<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.shape[0]<\/pre>\n<p><strong>5<\/strong><br \/>\n<span style=\"font-weight: 400\">Number of columns-<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.shape[1]<\/pre>\n<p><strong><span style=\"font-family: Verdana, Geneva, sans-serif\">4<\/span><\/strong><\/p>\n<h4><strong>d. Individual rows<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">The head() method will give us the first 5 rows of the data set, but we can also choose to print fewer or more.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.head(3)<\/pre>\n<div id=\"attachment_22047\" style=\"width: 368px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/head-2.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22047\" class=\"wp-image-22047 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/head-2.png\" alt=\"Python Pandas\" width=\"358\" height=\"84\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/head-2.png 358w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/head-2-150x35.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/head-2-300x70.png 300w\" sizes=\"auto, (max-width: 358px) 100vw, 358px\" \/><\/a><p id=\"caption-attachment-22047\" class=\"wp-caption-text\">Python Pandas Tutorial &#8211; Individual rows<\/p><\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt; furniture.tail(2)<\/pre>\n<div id=\"attachment_22049\" style=\"width: 353px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/tail.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22049\" class=\"wp-image-22049 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/tail.png\" alt=\"Python Pandas Tutorial\" width=\"343\" height=\"67\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/tail.png 343w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/tail-150x29.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/tail-300x59.png 300w\" sizes=\"auto, (max-width: 343px) 100vw, 343px\" \/><\/a><p id=\"caption-attachment-22049\" class=\"wp-caption-text\">Python Pandas Tutorial &#8211;\u00a0Individual rows<\/p><\/div>\n<h4><strong>e. Unique values<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">We can use the unique() function when we want to see what categories in the data set are unique.<\/span><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-defaultdict\/\">Let&#8217;s discuss Python Defaultdict<\/a><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.index.unique()<\/pre>\n<p><strong>Int64Index([0, 1, 2, 3, 4], dtype=&#8217;int64&#8242;)<\/strong><br \/>\n<span style=\"font-weight: 400\">And to find out how many, we make a call to nunique().<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.index.nunique()<\/pre>\n<p><strong>5<\/strong><\/p>\n<h3>DataFrames in Pandas<\/h3>\n<p><span style=\"font-weight: 400\">A DataFrame is an essential data structure with pandas. It lets us deal with data in a tabular fashion. The rows are observations, and the columns are variables.<\/span><\/p>\n<p><span style=\"font-weight: 400\">We have the following syntax for this-<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">pandas.DataFrame( data, index, columns, dtype, copy)<\/pre>\n<p><span style=\"font-weight: 400\">Such a data structure is-<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Mutable<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Variable columns<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Labeled axes<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Capable of performing arithmetic operations on columns and rows<\/span><\/li>\n<\/ul>\n<h4><strong>a. Creating a DataFrame<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">Let\u2019s see how we can create a DataFrame.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; df=pd.DataFrame({'company':['Amazon','Apple','Google','Facebook','Microsoft'],\r\n    'CEO':['Jeff Bezos','Tim Cook','Sundar Pichai','Mark Zuckerberg','Satya Nadella'],\r\n    'Founded':[1994,1976,1998,2004,1975]})\r\n&gt;&gt;&gt; df<\/pre>\n<div id=\"attachment_22050\" style=\"width: 329px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/df.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22050\" class=\"wp-image-22050 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/df.png\" alt=\"Python Pandas Tutorial\" width=\"319\" height=\"114\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/df.png 319w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/df-150x54.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/df-300x107.png 300w\" sizes=\"auto, (max-width: 319px) 100vw, 319px\" \/><\/a><p id=\"caption-attachment-22050\" class=\"wp-caption-text\">Python Pandas Tutorial &#8211; Creating a DataFrame<\/p><\/div>\n<h4><strong>b. Setting Indexes for a DataFrame<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">Now this indexes the dataframe as integers starting at 0. But we can put labels on these. Let\u2019s see how we can index it based on which company came first.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; df.index=['Third','Second','Fourth','Fifth','First']\r\n&gt;&gt;&gt; df<\/pre>\n<div id=\"attachment_22051\" style=\"width: 367px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/index-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22051\" class=\"wp-image-22051 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/index-1.png\" alt=\"Python Pandas Tutorial\" width=\"357\" height=\"114\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/index-1.png 357w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/index-1-150x48.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/index-1-300x96.png 300w\" sizes=\"auto, (max-width: 357px) 100vw, 357px\" \/><\/a><p id=\"caption-attachment-22051\" class=\"wp-caption-text\">Python Pandas Tutorial &#8211; Setting Indexes for a DataFrame<\/p><\/div>\n<h4><strong>c. Indexing a DataFrame<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">A column-<\/span><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-collections-module\/\">Let&#8217;s learn about Python collections<\/a><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; df['company']<\/pre>\n<p><strong>Third \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Amazon<\/strong><br \/>\n<strong>Second \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Apple<\/strong><br \/>\n<strong>Fourth \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Google<\/strong><br \/>\n<strong>Fifth \u00a0\u00a0\u00a0\u00a0\u00a0 Facebook<\/strong><br \/>\n<strong>First \u00a0\u00a0\u00a0\u00a0 Microsoft<\/strong><br \/>\n<strong>Name: company, dtype: object<\/strong><br \/>\n<span style=\"font-weight: 400\">This prints out a Series. Now, to print out a DataFrame, we can:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; df[['company']]<\/pre>\n<p><span style=\"font-weight: 400\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><strong> company<\/strong><br \/>\n<strong>Third \u00a0\u00a0\u00a0\u00a0\u00a0 Amazon<\/strong><br \/>\n<strong>Second \u00a0\u00a0\u00a0\u00a0\u00a0 Apple<\/strong><br \/>\n<strong>Fourth \u00a0\u00a0\u00a0\u00a0 Google<\/strong><br \/>\n<strong>Fifth \u00a0\u00a0\u00a0 Facebook<\/strong><br \/>\n<strong>First \u00a0\u00a0 Microsoft<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; df[['company','Founded']]<\/pre>\n<div id=\"attachment_22059\" style=\"width: 250px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/companyfounded.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22059\" class=\"wp-image-22059 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/companyfounded.png\" alt=\"Python Pandas Tutorial\" width=\"240\" height=\"111\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/companyfounded.png 240w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/companyfounded-150x69.png 150w\" sizes=\"auto, (max-width: 240px) 100vw, 240px\" \/><\/a><p id=\"caption-attachment-22059\" class=\"wp-caption-text\">Indexing a DataFrame<\/p><\/div>\n<h4><strong>d. Slicing a DataFrame<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">It is possible to slice a DataFrame to retrieve rows from it.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; df[0:3]<\/pre>\n<div id=\"attachment_22054\" style=\"width: 327px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/slicing.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22054\" class=\"wp-image-22054 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/slicing.png\" alt=\"Python Pandas Tutorial\" width=\"317\" height=\"81\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/slicing.png 317w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/slicing-150x38.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/slicing-300x77.png 300w\" sizes=\"auto, (max-width: 317px) 100vw, 317px\" \/><\/a><p id=\"caption-attachment-22054\" class=\"wp-caption-text\">Python Pandas Tutorial &#8211; Slicing a DataFrame<\/p><\/div>\n<h4><strong>e. More data selection operations<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">Using <\/span><i><span style=\"font-weight: 400\">loc<\/span><\/i><span style=\"font-weight: 400\"> and <\/span><i><span style=\"font-weight: 400\">iloc<\/span><\/i><span style=\"font-weight: 400\">, you can select certain rows in a data set. <\/span><i><span style=\"font-weight: 400\">loc<\/span><\/i><span style=\"font-weight: 400\"> uses string indices; <\/span><i><span style=\"font-weight: 400\">iloc<\/span><\/i><span style=\"font-weight: 400\"> uses integers.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; df.loc[['Second','Fifth']]<\/pre>\n<div id=\"attachment_22061\" style=\"width: 363px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/loc-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22061\" class=\"wp-image-22061 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/loc-1.png\" alt=\"Python Pandas Tutorial\" width=\"353\" height=\"67\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/loc-1.png 353w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/loc-1-150x28.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/loc-1-300x57.png 300w\" sizes=\"auto, (max-width: 353px) 100vw, 353px\" \/><\/a><p id=\"caption-attachment-22061\" class=\"wp-caption-text\">Python Pandas Tutorial &#8211; More data selection operations<\/p><\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; df.iloc[3]<\/pre>\n<div id=\"attachment_22066\" style=\"width: 233px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/iloc.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22066\" class=\"wp-image-22066 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/iloc.png\" alt=\"Pandas Tutorial\" width=\"223\" height=\"83\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/iloc.png 223w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/iloc-150x56.png 150w\" sizes=\"auto, (max-width: 223px) 100vw, 223px\" \/><\/a><p id=\"caption-attachment-22066\" class=\"wp-caption-text\">Pandas Tutorial<\/p><\/div>\n<p><span style=\"font-weight: 400\">Getting more than one column-<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; df.iloc[:,1:4]<\/pre>\n<div id=\"attachment_22062\" style=\"width: 283px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/iloc2.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22062\" class=\"wp-image-22062 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/iloc2.png\" alt=\"Pandas Tutorial\" width=\"273\" height=\"116\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/iloc2.png 273w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/iloc2-150x64.png 150w\" sizes=\"auto, (max-width: 273px) 100vw, 273px\" \/><\/a><p id=\"caption-attachment-22062\" class=\"wp-caption-text\">Python Pandas Tutorial<\/p><\/div>\n<h3>Manipulating the Datasets in Pandas<\/h3>\n<p><span style=\"font-weight: 400\">So far, we\u2019ve seen how we can find out more about a dataset (and also, how to set indexes to it, okay). Now let\u2019s see what we can do to it.<\/span><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-jobs\/\">Let&#8217;s explore Python Jobs<\/a>.\u00a0<\/strong><\/p>\n<h4><strong>a. Changing the data type<\/strong><\/h4>\n<h4><span style=\"font-weight: 400\">Let\u2019s use the furniture dataset for this.<\/span><\/h4>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.Cost=furniture.Cost.astype(float)\r\n&gt;&gt;&gt; furniture<\/pre>\n<div id=\"attachment_22067\" style=\"width: 410px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/furniture.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22067\" class=\"wp-image-22067 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/furniture.png\" alt=\"Python Pandas Tutorial\" width=\"400\" height=\"114\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/furniture.png 400w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/furniture-150x43.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/furniture-300x86.png 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/a><p id=\"caption-attachment-22067\" class=\"wp-caption-text\">Python Pandas Tutorial &#8211; Changing the data type<\/p><\/div>\n<h4><strong>b. Creating a frequency distribution<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">For this purpose, we have the method value_counts().<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.index=['A','B','A','A','C']\r\n&gt;&gt;&gt; furniture.index.value_counts(ascending=True)<\/pre>\n<p><span style=\"font-weight: 400\">C \u00a0\u00a0\u00a01<\/span><br \/>\n<span style=\"font-weight: 400\">B \u00a0\u00a0\u00a01<\/span><br \/>\n<span style=\"font-weight: 400\">A \u00a0\u00a0\u00a03<\/span><br \/>\n<span style=\"font-weight: 400\">dtype: int64<\/span><\/p>\n<h4><strong>c. Creating a crosstab<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">A crosstab creates a bivariate frequency distribution.<\/span><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-read-and-write-file\/\">Learn more about Python read &amp; write files<\/a><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pd.crosstab(furniture.index,furniture.Brand)<\/pre>\n<div id=\"attachment_22068\" style=\"width: 404px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/crosstab.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22068\" class=\"wp-image-22068 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/crosstab.png\" alt=\"Pandas Tutorial\" width=\"394\" height=\"97\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/crosstab.png 394w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/crosstab-150x37.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/crosstab-300x74.png 300w\" sizes=\"auto, (max-width: 394px) 100vw, 394px\" \/><\/a><p id=\"caption-attachment-22068\" class=\"wp-caption-text\">Python Pandas Tutorial &#8211; Creating a crosstab<\/p><\/div>\n<h4><strong>d. Choosing one column as an index<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">You can choose one of the columns in your dataset to index others.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; df.set_index('company',inplace=True)\r\n&gt;&gt;&gt; df<\/pre>\n<div id=\"attachment_22069\" style=\"width: 303px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/setindex.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22069\" class=\"wp-image-22069 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/setindex.png\" alt=\"Python Pandas Tutorial\" width=\"293\" height=\"132\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/setindex.png 293w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/setindex-150x68.png 150w\" sizes=\"auto, (max-width: 293px) 100vw, 293px\" \/><\/a><p id=\"caption-attachment-22069\" class=\"wp-caption-text\">Pandas Tutorial -Choosing one column as index<\/p><\/div>\n<p><span style=\"font-weight: 400\">To reset this, you can:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; df.reset_index(inplace=True)\r\n&gt;&gt;&gt; df<\/pre>\n<div id=\"attachment_22070\" style=\"width: 326px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/resetindex.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22070\" class=\"wp-image-22070 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/resetindex.png\" alt=\"Python Pandas Tutorial\" width=\"316\" height=\"112\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/resetindex.png 316w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/resetindex-150x53.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/resetindex-300x106.png 300w\" sizes=\"auto, (max-width: 316px) 100vw, 316px\" \/><\/a><p id=\"caption-attachment-22070\" class=\"wp-caption-text\">Pandas Tutorial &#8211; Choosing one column as index<\/p><\/div>\n<h4><strong>e. Sorting data<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">For this, we use the function sort_values().<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.sort_values('Cost',ascending=False)<\/pre>\n<div id=\"attachment_22071\" style=\"width: 408px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/sortvalues.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22071\" class=\"wp-image-22071 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/sortvalues.png\" alt=\"Python Pandas Tutorial\" width=\"398\" height=\"114\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/sortvalues.png 398w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/sortvalues-150x43.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/sortvalues-300x86.png 300w\" sizes=\"auto, (max-width: 398px) 100vw, 398px\" \/><\/a><p id=\"caption-attachment-22071\" class=\"wp-caption-text\">Python Pandas Tutorial &#8211; Sorting data<\/p><\/div>\n<h4><strong>f. Renaming variables<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">Let\u2019s rename the variable \u2018company\u2019 to \u2018Company\u2019.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; df.columns=['Company','CEO','Founded']\r\n&gt;&gt;&gt; df<\/pre>\n<div id=\"attachment_22075\" style=\"width: 325px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/rename-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22075\" class=\"wp-image-22075 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/rename-1.png\" alt=\"Pandas Tutorial\" width=\"315\" height=\"114\" \/><\/a><p id=\"caption-attachment-22075\" class=\"wp-caption-text\">Python Pandas Tutorial &#8211; Renaming variables<\/p><\/div>\n<p><span style=\"font-weight: 400\">Or we can:<\/span><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-for-data-science\/\">Do you know about Python Data Science<\/a><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.rename(columns={'Product':'Category'},inplace=True)\r\n&gt;&gt;&gt; furniture<\/pre>\n<div id=\"attachment_22073\" style=\"width: 384px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/rename1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22073\" class=\"wp-image-22073 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/rename1.png\" alt=\"Python Pandas\" width=\"374\" height=\"111\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/rename1.png 374w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/rename1-150x45.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/rename1-300x89.png 300w\" sizes=\"auto, (max-width: 374px) 100vw, 374px\" \/><\/a><p id=\"caption-attachment-22073\" class=\"wp-caption-text\">Renaming variables<\/p><\/div>\n<h4><strong>g. Dropping rows and columns<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">It is possible to drop any number of rows and columns you want.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.drop('Cost',axis=1)<\/pre>\n<div id=\"attachment_22077\" style=\"width: 326px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/drop-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22077\" class=\"wp-image-22077 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/drop-1.png\" alt=\"Python Pandas\" width=\"316\" height=\"115\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/drop-1.png 316w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/drop-1-150x55.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/drop-1-300x109.png 300w\" sizes=\"auto, (max-width: 316px) 100vw, 316px\" \/><\/a><p id=\"caption-attachment-22077\" class=\"wp-caption-text\">Dropping rows and columns<\/p><\/div>\n<h4><strong>h. Creating new variables<\/strong><\/h4>\n<p><span style=\"font-weight: 400\">Now, let\u2019s add 10% of the cost to itself and find out the gross amount.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture['Gross']=furniture.eval('Cost+(Cost*(0.1))')\r\n&gt;&gt;&gt; furniture<\/pre>\n<div id=\"attachment_22078\" style=\"width: 456px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/createnewtable.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22078\" class=\"wp-image-22078 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/createnewtable.png\" alt=\"Python Pandas\" width=\"446\" height=\"113\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/createnewtable.png 446w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/createnewtable-150x38.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/createnewtable-300x76.png 300w\" sizes=\"auto, (max-width: 446px) 100vw, 446px\" \/><\/a><p id=\"caption-attachment-22078\" class=\"wp-caption-text\">Creating New Variables<\/p><\/div>\n<h3>Describing a Dataset in Pandas<\/h3>\n<p><span style=\"font-weight: 400\">Here, with the describe() method, we can find out information about a dataset- min, max, mean, count, and more.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.describe()<\/pre>\n<div id=\"attachment_22083\" style=\"width: 360px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/describe-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22083\" class=\"wp-image-22083 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/describe-1.png\" alt=\"Pandas Pandas Tutorial\" width=\"350\" height=\"194\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/describe-1.png 350w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/describe-1-150x83.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/describe-1-300x166.png 300w\" sizes=\"auto, (max-width: 350px) 100vw, 350px\" \/><\/a><p id=\"caption-attachment-22083\" class=\"wp-caption-text\">Pandas Tutorial &#8211; Describing a Dataset<\/p><\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.Gross.max()<\/pre>\n<p><span style=\"font-weight: 400\">55000.0<\/span><\/p>\n<h3>Pandas groupby Function<\/h3>\n<p><span style=\"font-weight: 400\">Generally, this operation lets you group data on a variable.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.groupby('Category').Gross.min()<\/pre>\n<div id=\"attachment_22084\" style=\"width: 378px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/groupby-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22084\" class=\"wp-image-22084 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/groupby-1.png\" alt=\"Python Pandas\" width=\"368\" height=\"128\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/groupby-1.png 368w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/groupby-1-150x52.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/groupby-1-300x104.png 300w\" sizes=\"auto, (max-width: 368px) 100vw, 368px\" \/><\/a><p id=\"caption-attachment-22084\" class=\"wp-caption-text\">Pandas Tutorial &#8211; groupby Function<\/p><\/div>\n<p><span style=\"font-weight: 400\">agg() lets us find out different values like count and min.<\/span><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-modules-vs-packages\/\">Have a look at Python Modules vs packages<\/a><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.groupby('Category').Gross.agg(['count','min','max','mean'])<\/pre>\n<div id=\"attachment_22085\" style=\"width: 461px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/groupbyagg.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22085\" class=\"wp-image-22085 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/groupbyagg.png\" alt=\"Python Pandas \" width=\"451\" height=\"149\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/groupbyagg.png 451w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/groupbyagg-150x50.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/groupbyagg-300x99.png 300w\" sizes=\"auto, (max-width: 451px) 100vw, 451px\" \/><\/a><p id=\"caption-attachment-22085\" class=\"wp-caption-text\">Group by function in pandas<\/p><\/div>\n<h3>Filtering in Python Pandas<\/h3>\n<p><span style=\"font-weight: 400\">Now, you can perform filtering in two ways-<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture[furniture.index==2]<\/pre>\n<div id=\"attachment_22091\" style=\"width: 439px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/filter.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22091\" class=\"wp-image-22091 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/filter.png\" alt=\"Python Pandas tutorial\" width=\"429\" height=\"51\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/filter.png 429w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/filter-150x18.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/filter-300x36.png 300w\" sizes=\"auto, (max-width: 429px) 100vw, 429px\" \/><\/a><p id=\"caption-attachment-22091\" class=\"wp-caption-text\">Python Pandas &#8211; Filtering<\/p><\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.loc[furniture.index==2,:]<\/pre>\n<p><span style=\"font-weight: 400\">And then of course, you can group conditions. Or:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture[furniture.index.isin([1,3])]<\/pre>\n<div id=\"attachment_22092\" style=\"width: 437px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/filter2-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22092\" class=\"wp-image-22092 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/filter2-1.png\" alt=\"Python Pandas\" width=\"427\" height=\"52\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/filter2-1.png 427w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/filter2-1-150x18.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/filter2-1-300x37.png 300w\" sizes=\"auto, (max-width: 427px) 100vw, 427px\" \/><\/a><p id=\"caption-attachment-22092\" class=\"wp-caption-text\">Filtering in Groupby<\/p><\/div>\n<h3>Missing Values in Pandas<\/h3>\n<p><span style=\"font-weight: 400\">Basically, isnull() will tell her if a column misses a value or more.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.isnull()<\/pre>\n<div id=\"attachment_22089\" style=\"width: 373px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/isnull.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22089\" class=\"wp-image-22089 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/isnull.png\" alt=\"Python Pandas\" width=\"363\" height=\"112\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/isnull.png 363w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/isnull-150x46.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/isnull-300x93.png 300w\" sizes=\"auto, (max-width: 363px) 100vw, 363px\" \/><\/a><p id=\"caption-attachment-22089\" class=\"wp-caption-text\">Missing Values in Pandas<\/p><\/div>\n<p><span style=\"font-weight: 400\">Similarly, notnull() returns False for a NaN.<\/span><br \/>\n<span style=\"font-weight: 400\">Number of missing values-<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.isnull().sum()<\/pre>\n<div id=\"attachment_22090\" style=\"width: 242px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/countofnull.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22090\" class=\"wp-image-22090 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/countofnull.png\" alt=\"python Pandas\" width=\"232\" height=\"115\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/countofnull.png 232w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/countofnull-150x74.png 150w\" sizes=\"auto, (max-width: 232px) 100vw, 232px\" \/><\/a><p id=\"caption-attachment-22090\" class=\"wp-caption-text\">Missing Values in Pandas<\/p><\/div>\n<p><span style=\"font-weight: 400\">To drop a missing value, you can use dropna(), and to fill it, use fillna().<\/span><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-regex-tutorial\/\">Learn about Python regular expressions<\/a><\/strong><\/p>\n<h3>Ranking in Python Pandas<\/h3>\n<p><span style=\"font-weight: 400\">Now, to rank every variable according to its value, we can use rank().<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; furniture.rank()<\/pre>\n<div id=\"attachment_22088\" style=\"width: 457px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/rank-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22088\" class=\"wp-image-22088 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/rank-1.png\" alt=\"Python Pandas Tutorial\" width=\"447\" height=\"117\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/rank-1.png 447w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/rank-1-150x39.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/rank-1-300x79.png 300w\" sizes=\"auto, (max-width: 447px) 100vw, 447px\" \/><\/a><p id=\"caption-attachment-22088\" class=\"wp-caption-text\">Python Pandas &#8211; Ranking<\/p><\/div>\n<h2>13. Python Pandas Tutorial &#8211; Concatenating DataFrames<\/h2>\n<p><span style=\"font-weight: 400\">So, with the concat() method, we can concatenate two or more DataFrames.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pd.concat([df,furniture])<\/pre>\n<div id=\"attachment_22086\" style=\"width: 505px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/concat-1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22086\" class=\"wp-image-22086 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/concat-1.png\" alt=\"Python Pandas\" width=\"495\" height=\"191\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/concat-1.png 495w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/concat-1-150x58.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/concat-1-300x116.png 300w\" sizes=\"auto, (max-width: 495px) 100vw, 495px\" \/><\/a><p id=\"caption-attachment-22086\" class=\"wp-caption-text\">Python Pandas &#8211; Concatenating DataFrames<\/p><\/div>\n<p><span style=\"font-weight: 400\">Let\u2019s see what happens when we concatenate this with df.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pd.concat([df,furniture,df])<\/pre>\n<div id=\"attachment_22087\" style=\"width: 507px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/concat2.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-22087\" class=\"wp-image-22087 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/concat2.png\" alt=\"Python Pandas\" width=\"497\" height=\"303\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/concat2.png 497w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/concat2-150x91.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/concat2-300x183.png 300w\" sizes=\"auto, (max-width: 497px) 100vw, 497px\" \/><\/a><p id=\"caption-attachment-22087\" class=\"wp-caption-text\">Concatenating DataFrames in Pandas<\/p><\/div>\n<h3>Series in\u00a0Pandas<\/h3>\n<p><span style=\"font-weight: 400\">Now, another important data structure in pandas is a Series. This is a one-dimensional array; it is labeled and can hold more than one kind of data.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pd.Series([2,4,'c'])<\/pre>\n<p><strong>0 \u00a0\u00a0\u00a0 2<\/strong><br \/>\n<strong>1 \u00a0\u00a0\u00a0 4<\/strong><br \/>\n<strong>2 \u00a0\u00a0\u00a0 c<\/strong><br \/>\n<strong>dtype: object<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; pd.Series({1:'a',2:'b'})<\/pre>\n<p><strong>1 \u00a0\u00a0\u00a0 a<\/strong><br \/>\n<strong>2 \u00a0\u00a0\u00a0 b<\/strong><br \/>\n<strong>dtype: object<\/strong><br \/>\n<strong><a href=\"https:\/\/data-flair.training\/blogs\/python-packages\/\">Read Python packages<\/a><\/strong><\/p>\n<h3>Panels in Pandas<\/h3>\n<p><span style=\"font-weight: 400\">Finally, we come to panels. A panel holds data in 3 dimensions. As we said above, the term \u2018pandas\u2019 comes as a portmanteau of the words \u201cpanel\u201d and \u201cdata\u201d. A declaration for a panel takes in three parameters- items, major_axis, and minor_axis.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; import numpy as np\r\n&gt;&gt;&gt; pd.Panel(np.random.rand(2,4,5))\r\n&lt;class 'pandas.core.panel.Panel'&gt;<\/pre>\n<p><strong>Dimensions: 2 (items) x 4 (major_axis) x 5 (minor_axis)<\/strong><br \/>\n<strong>Items axis: 0 to 1<\/strong><br \/>\n<strong>Major_axis axis: 0 to 3<\/strong><br \/>\n<strong>Minor_axis axis: 0 to 4<\/strong><\/p>\n<p>So, this was all in the Python pandas Tutorial. Hope you like our explanation.<\/p>\n<h3>Conclusion<\/h3>\n<p><span style=\"font-weight: 400\">Hence, in this Python Pandas Tutorial, we learn Pandas in Python. Moreover, we discussed Pandas example, features, installation, and data sets. Also, we saw Data frames and the manipulation of data sets. Still, if any doubt regarding Pandas in Python, ask in the comments tab.<\/span><\/p>\n<p><strong>See also &#8211;\u00a0<\/strong><br \/>\n<a href=\"https:\/\/data-flair.training\/blogs\/python-interpreter\/\"><b>Python Interpreter<\/b><\/a><br \/>\n<a href=\"https:\/\/pandas.pydata.org\/\"><strong>For reference<\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our last Python Library tutorial, we discussed Python Scipy. Today, we will look at a Python Pandas Tutorial. In this Pandas tutorial, we will learn the exact meaning of Pandas in Python. Moreover,&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":22105,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[3315,3457,4616,6219,8158,9396,9399,9401,10757,12747,15842],"class_list":["post-22042","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-data-frames-in-pandas","tag-data-sets-in-pandas","tag-features-of-pandas","tag-how-to-install-pandas","tag-learn-pandas","tag-pandas-installation","tag-pandas-tutorial","tag-panels-in-pandas","tag-python-pandas-tutorial","tag-series-in-pandas","tag-what-is-pandas"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Pandas Tutorial - Learn Pandas in Python - DataFlair<\/title>\n<meta name=\"description\" content=\"Python Pandas tutorial:what is Pandas in Python,pandas example,features,learn pandas installation,data sets in pandas,dataframes in pandas,series,panels\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Pandas Tutorial - Learn Pandas in Python - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Python Pandas tutorial:what is Pandas in Python,pandas example,features,learn pandas installation,data sets in pandas,dataframes in pandas,series,panels\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-07-20T04:00:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-28T09:24:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Pandas-Tutorial-01.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Pandas Tutorial - Learn Pandas in Python - DataFlair","description":"Python Pandas tutorial:what is Pandas in Python,pandas example,features,learn pandas installation,data sets in pandas,dataframes in pandas,series,panels","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"Python Pandas Tutorial - Learn Pandas in Python - DataFlair","og_description":"Python Pandas tutorial:what is Pandas in Python,pandas example,features,learn pandas installation,data sets in pandas,dataframes in pandas,series,panels","og_url":"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-07-20T04:00:01+00:00","article_modified_time":"2026-04-28T09:24:43+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Pandas-Tutorial-01.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Python Pandas Tutorial &#8211; Learn Pandas in Python","datePublished":"2018-07-20T04:00:01+00:00","dateModified":"2026-04-28T09:24:43+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/"},"wordCount":1816,"commentCount":7,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Pandas-Tutorial-01.jpg","keywords":["data frames in pandas","data sets in pandas","features of pandas","how to install pandas","Learn pandas","pandas installation","pandas tutorial","panels in Pandas","Python pandas tutorial","series in pandas","what is Pandas"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/pandas-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/","url":"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/","name":"Python Pandas Tutorial - Learn Pandas in Python - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Pandas-Tutorial-01.jpg","datePublished":"2018-07-20T04:00:01+00:00","dateModified":"2026-04-28T09:24:43+00:00","description":"Python Pandas tutorial:what is Pandas in Python,pandas example,features,learn pandas installation,data sets in pandas,dataframes in pandas,series,panels","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/pandas-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Pandas-Tutorial-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/07\/Python-Pandas-Tutorial-01.jpg","width":1200,"height":628,"caption":"Python Pandas Tutorial 2018 | Learn Pandas in Python"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/pandas-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Python Pandas Tutorial &#8211; Learn Pandas in Python"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/22042","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=22042"}],"version-history":[{"count":8,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/22042\/revisions"}],"predecessor-version":[{"id":148018,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/22042\/revisions\/148018"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/22105"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=22042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=22042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=22042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}