There are three types of Data Structure in Pandas. Prior to Pandas, Python was only used for data wrangling and preparation. Using Pandas we can perform more steps in the processing and analysis of data- Load, Prepare, Manipulate, Model, and Analyze using its powerful data structures.
Pandas have three types of data structures-
- Series
- DataFrame
- Panel
1. Series
A Series is a one dimensional array like structure with homogeneous data. The values of the series are mutable means we can change any value in series, but the size of the series is immutable so we can not change the size of the series. A series can hold any type of data like integer, decimal, string, python objects, etc. For Example
5 | 12 | 7 | 3 | 25 | 19 |
2.6 | 3.1 | 13.4 | 25.3 | 8.2 | 3.19 |
in the above example, Series 1 has integer numbers whereas Series 2 has decimal numbers so it is called homogeneous. we can not put a decimal number in an integer number series or any integer number in any decimal number series.
2. DataFrame
DataFrame is a two-dimensional array with heterogeneous data. A DataFrame size is mutable and data is also mutable so we can change the data and size of DataFrame at any time. For example
S. no. | Name | Account no | salary |
1 | Ajay | 33206636256525 | 15000 |
2 | Rohit | 33265215035156 | 20000 |
3 | Vivek | 33625615125110 | 18000 |
4 | Rahul | 33252651665254 | 21000 |
5 | Lucky | 33265154521515 | 16000 |
6 | Mohit | 33545415446415 | 20000 |
The table represents the data of a company employee. The data is represented in rows and columns. Each column represents an attribute and each row represents a person
.
3. Panel
The panel is a three-dimensional data structure with heterogeneous data. It is very hard to represent the Panel in a graphical representation. But a Panel can be illustrated as a container of a DataFrame. In Panel Data and size are mutable.
Data Structure | Dimension | Data Type | Data | Size |
Series | One-dimensional Array | Homogeneous | Mutable | immutable |
Data Frame | Two-dimensional Array | Heterogeneous | Mutable | Mutable |
Panel | Three-dimensional Array | Heterogeneous | Mutable | Mutable |