DEV Community

Punitha
Punitha

Posted on

Introduction and installing Pandas

What is Pandas?

  • Pandas is a Python library used for working with and analyzing data.

It helps:

  • Store data in rows and columns
  • Read data from CSV and Excel files
  • Filter data
  • Sort data
  • Handle missing values
  • Group and summarize data
  • Combine different datasets
  • Analyze real-world data

Why Do We Use Pandas?

  • Pandas is mainly used for data analysis and data manipulation.

For example, we can use Pandas to:

  • Find the average marks
  • Find students who scored above 80
  • Remove duplicate records
  • Handle missing values
  • Sort students by marks
  • Group students by grade
  • Read a CSV dataset
  • Save the processed data into a new file

Installing Pandas

  • Open Command Prompt / Terminal and run:
pip install pandas

python -m pip install pandas
Enter fullscreen mode Exit fullscreen mode

Import Pandas

  • After installation, import Pandas into your Python program.
import pandas as pd
Enter fullscreen mode Exit fullscreen mode

Here:

  • pandas β†’ library name

  • pd β†’ commonly used short name for Pandas

Example

import pandas as pd

print(pd.__version__)
Enter fullscreen mode Exit fullscreen mode

This displays the installed Pandas version.

Top comments (0)