0
0
Pandasdata~5 mins

What is Pandas

Choose your learning style9 modes available
Introduction

Pandas helps you work with tables of data easily. It makes data analysis faster and simpler.

You have a spreadsheet of sales data and want to find totals.
You want to clean messy data before using it.
You need to combine data from different sources into one table.
You want to quickly explore and summarize data.
You want to prepare data for charts or machine learning.
Syntax
Pandas
import pandas as pd

data = {'Name': ['Anna', 'Bob'], 'Age': [28, 34]}
df = pd.DataFrame(data)

pd is a common short name for pandas.

DataFrame is the main table structure in pandas.

Examples
Create a simple table with names and ages.
Pandas
import pandas as pd

data = {'Name': ['Anna', 'Bob'], 'Age': [28, 34]}
df = pd.DataFrame(data)
print(df)
Load data from a CSV file and show the first 5 rows.
Pandas
import pandas as pd

df = pd.read_csv('data.csv')
print(df.head())
Sample Program

This program creates a table of cities and their populations, then prints it.

Pandas
import pandas as pd

data = {'City': ['Paris', 'London', 'Berlin'], 'Population': [2148000, 8982000, 3769000]}
df = pd.DataFrame(data)
print(df)
OutputSuccess
Important Notes

Pandas works best with tables like Excel sheets.

It can handle missing or messy data easily.

Learning pandas helps you analyze data faster.

Summary

Pandas is a tool to work with tables of data in Python.

It helps you load, clean, and analyze data quickly.

DataFrames are the main way pandas stores data.