What are the different types of data structures in pandas? | Series, DataFrame and Panel in pandas | Differentiate Series, DataFrame and panel

 Data Structures in Pandas                    

   Series, DataFrame and Panel 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.

Data Structures in Pandas

Pandas have three types of data structures-
  1. Series
  2. DataFrame
  3. Panel
These all are built with a Numpy array.

    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

 

15 20 4 9 40 10
20.1 2.5 4.6 9.7 20.3 1.8

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
 

 

 
 
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.

 

 

The difference among Series, DataFrame, and panel

Data Structure Dimensions Data Type Data Size
Series One-dimensional array Homogeneous data Mutable Immutable
Data Frame Two-dimensional array Heterogeneous data Mutable Mutable
Panel Three-dimensional array Heterogeneous data Mutable Mutable


If you like my post please share it with your friends by simply clicking the below social media button, and Don’t forget to comment so we will update ourselves.

Share in a Single Click

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *