0% found this document useful (0 votes)
8 views2 pages

Pandas Quick Guide

Pandas is a powerful Python library for data manipulation and analysis, featuring Series and DataFrame data structures. It can be installed via pip and allows users to create DataFrames, read data from various file formats, inspect, select, and modify data efficiently. Key operations include adding columns, updating values, dropping columns, and renaming them.

Uploaded by

vigneshcs2k7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Pandas Quick Guide

Pandas is a powerful Python library for data manipulation and analysis, featuring Series and DataFrame data structures. It can be installed via pip and allows users to create DataFrames, read data from various file formats, inspect, select, and modify data efficiently. Key operations include adding columns, updating values, dropping columns, and renaming them.

Uploaded by

vigneshcs2k7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Python Pandas - Quick Guide

1. What is pandas?

pandas is a powerful Python library for data manipulation and analysis. It provides two main data structures: Series (1D)
and DataFrame (2D).

2. Installing pandas

Install pandas using pip:


pip install pandas

3. Importing pandas

import pandas as pd

4. Creating a DataFrame

data = {'Name': ['Alice', 'Bob'], 'Age': [25, 30]}


df = pd.DataFrame(data)

5. Reading Data

df = pd.read_csv('file.csv')
df = pd.read_excel('file.xlsx')

6. Inspecting Data

df.head() - First 5 rows


df.tail() - Last 5 rows
df.shape - Dimensions
df.columns - Column names
df.info() - Summary
df.describe() - Statistics

7. Selecting Data

df['Age'] - Single column


df[['Name', 'Age']] - Multiple columns
df.iloc[0] - Row by position
df.loc[0] - Row by index
df[df['Age'] > 25] - Conditional

8. Modifying Data

df['NewCol'] = df['Age'] + 5 - Add column


df.at[0, 'Age'] = 26 - Update value
df.drop('Col', axis=1) - Drop column
Python Pandas - Quick Guide

df.rename(columns={'Old': 'New'}) - Rename


df['Col'].replace('old', 'new') - Replace

You might also like