Skip to Content

Session-9_Pandas.pptx

Introduction to Pan​das


"Python is an experiment in how much freedom programmers need. Too much freedom and nobody can read another's code; too little and expressiveness is endangered."



--​Guido Van Rossum

The quote is more relevant today than ever. As Python continues to power industries—from education to space tech—its design philosophy ensures that code remains a tool for both creativity and collaboration.


Pre-requisite Knowledge

To understand and effectively learn the content of this chapter on Pandas, students should be familiar with the following foundational concepts:

  • Basic Python Programming Concepts 
  • Python List and Dictionary 
  • Loops and Iteration
  • Basic File Handling 
  • Python IDE Usage:
      • Knowledge of working in any Python platform such as:
        • IDLE
        • Jupyter Notebook
        • PictoBlox


Learning Objectives

After completing this chapter, students will be able to:

  • Understand the Purpose and Importance of Pandas.
  • Install and Import the Pandas Library
  • Recognize and Work with Pandas Data Structures 
  • Create and Manipulate DataFrames 
  • Perform Basic Data Operations 

Requirements

  • For Pandas library in python, we have various platforms to execute our programs.

​​Like: - Pictoblox, Python-IDLE, Jupyter Notebook

  • In this we are going to use Python-IDLE.

👨‍🏫​Introduction to Pandas

Pandas is a library for the Python programming language, providing fast, flexible, and expressive data structures designed to make working with structured data easy and intuitive.

The Pandas library has two primary data structures:

1.    Series: A one-dimensional labelled array capable of holding data of any type.

2.    DataFrame: A two-dimensional table-like structure with rows and columns, suitable for storing and manipulating tabular data.


 Features of Pandas Library:


Features

Description

Two-Dimensional

Data is arranged in rows and columns.

Labeled Axes

Each row and column has labels (index and column names).

Mixed Data Types

Columns can hold different types of data (integers, strings, floats, etc.).

Flexible Indexing

You can access data by row number or label.

Power Function

Supports sorting, filtering, grouping, aggregation, and more.


 Installation: 


​Step 1: Open Terminal or Command Prompt:

        • Press Enter.
        • Mac/Linux: Open the Terminal from your Application or search bar.

​Step 2:  Install Pandas using pip:

​Step 3:  Wait for the installation to complete.



Creating a DataFrame

A DataFrame is a two-dimensional table-like structure. You can create one from a ​dictionary, CSV file, or other data sources.

Creating a DataFrame in Python using the Pandas library through Python IDLE involves a few simple steps:

​Step 1: ​Open Python IDLE.

        • Go to Start Menu → Search for IDLE (Python GUI) and open it.

​Step 2: ​Import the Pandas Library.

        • pd is a commonly used alias for the Pandas library. 


​Step 3: ​Create a Dictionary with Data.

        •  This converts the dictionary into a Pandas DataFrame structure.

​Step 5: ​ Display the DataFrame 

        • ​ This will show the tabular data in the output. 

Final Code:



Output:


🔍 Explanation of the Output:

  • Rows are automatically numbered using an index starting from 0.
  • Columns are labeled (Name, Age, Grade).
  • Each row represents a data record (e.g., one student's information).
  • Each column represents a feature of the data (e.g., age or grade).


✍️ Note:

  • You must ensure Pandas is installed using pip install pandas before importing.

  • This method can be used to create simple school reports, attendance sheets, etc.


 
0 0

There are no comments for now.

to be the first to leave a comment.