VOOZH about

URL: https://www.geeksforgeeks.org/python/python-data-analysis-using-pandas/

⇱ Data analysis using Pandas - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Data analysis using Pandas

Last Updated : 11 Jul, 2025

Pandas are the most popular python library that is used for data analysis. It provides highly optimized performance with back-end source code purely written in C or Python

We can analyze data in Pandas with:

Pandas Series

Series in Pandas is one dimensional(1-D) array defined in pandas that can be used to store any data type.

Creating Pandas Series

Here, Data can be:

  1. A Scalar value which can be integerValue, string
  2. A Python Dictionary which can be Key, Value pair
  3. A Ndarray

Note: Index by default is from 0, 1, 2, ...(n-1) where n is the length of data.  

Create Series from List

 Creating series with predefined index values.

Output:

👁 Create Series from List
 
👁 Image
 

Create Pandas Series from Dictionary

Program to Create Pandas series from Dictionary.

Output:

👁 Create Pandas Series from Dictionary
Dictionary type data

Convert an Array to Pandas Series

Program to Create ndarray series.

Output:

👁 Convert an Array to Pandas Series
Data as Ndarray

Pandas DataFrames

The DataFrames in Pandas is a two-dimensional (2-D) data structure defined in pandas which consists of rows and columns.

Creating a Pandas DataFrame

Here, Data can be:

  1. One or more dictionaries
  2. One or more Series
  3. 2D-numpy Ndarray

Create a Pandas DataFrame from multiple Dictionary

Program to Create a Dataframe with two dictionaries.

Output:

👁 Create a Pandas DataFrame from multiple Dictionary
DataFrame with two dictionaries

Convert list of dictionaries to a Pandas DataFrame

Here, we are taking three dictionaries and with the help of from_dict() we convert them into Pandas DataFrame.

Output:

  A B C D
0 5 0 3 3
1 7 9 3 5
2 2 4 7 6

Create DataFrame from Multiple Series

Program to create a dataframe of three Series.

Output:

👁 Create DataFrame from Multiple Series
DataFrame with three series

Convert a Array to Pandas Dataframe

One constraint has to be maintained while creating a DataFrame of 2D arrays - The dimensions of the 2D array must be the same.

Output:

👁 Convert a Array to Pandas Dataframe
DataFrame with 2d ndarray
Comment
Article Tags: