Learn Python
Learn Data Structure & Algorithm
Learn Numpy
Pandas Introduction
Pandas Series
Pandas DataFrame
Pandas Read Files
Pandas Some functions and properties
Pandas Math Function
Pandas Selection
Pandas Change Type
Pandas Concatenate & Split
Pandas Sorting
Pandas Filter
Pandas Data Cleaning
Pandas Group by
Pandas Time Series
Pandas Analysis 1
Pandas Analysis 2
Pandas Analysis 3
Matplotlib
Learn Seaborn
Learn Statistics
Learn Math
Learn MATLAB
Learn Machine learning
Learn Github
Learn OpenCV
Learn Deep Learning
Learn MySQL
Learn MongoDB
Learn Web scraping
Learn Excel
Learn Power BI
Learn Tableau
Learn Docker
Learn Hadoop
A series is a one-dimensional labeled array or we can say it is a single list which has index number. Here we
have two things, 1. index and 2. value.
It can hold data of any type (integer, string, float, python objects, etc). Pandas series is the same as a
column in an excel sheet or we can compare it with a single column of a table. Using pandas we can create a
series and can perform many works like fill the empty cell, sorting, mathematical calculations, filter data
from the series, etc.
Example of a series:
Grade | |
---|---|
0 | A+ |
1 | B+ |
2 | A |
3 | B- |
4 | C |
5 | B- |
6 | A+ |
Here in the table, we can see a column with index numbers. It is a series. In the table, if we have multiple columns then an individual column is a series. By joining multiple series we can create a table or data frame.
To create a series in pandas, series() function is used. In the bracket of series function, pass a list, dictionary, or variable name(which contains a list or dictionary).
In the example 1 we created a series using a python list.
If you use a dictionary to create a series then all the keys of the dictionary will become the index number.
By using the index parameter you can change the series index numbers. To do this write index then use a equal sign(=) and then pass the new index numbers as a list.
In the example we created our own custom index for the series.
By using dtype parameter you can change the series data type.
In the example list we have integer elements or numbers but in series we have float numbers. It happens because of dtype parameter of series function.
By using the name parameter you can give a name of a series.
In the example we gave a name to the list Rafsun by using name parameter.
Using the series index number we can get a particular value or a particular range of value from the series. In the series the index number starts from 0 and the end index number is n-1.
In the example we pass 2 in the third bracket so the get the third index value of the series. As we know the indexing starts from 0 so if count then we will see the third element index number is 2.
We can also perform mathematical operations like subtraction, addition, multiplication, division, etc on a series.
In the example 1 we have two lists which we converted into a series. Then we do addition of these two series. So you can also perform mathematical operations between two series but the list size must be same.
You can get series data using condition. Here you will use a condition according to your need and according to the given condition you will get the output.