0% found this document useful (0 votes)
3 views

Pandas_Presentation

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

Pandas_Presentation

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

Introduction to Pandas

A Comprehensive Python Library for


Data Manipulation
By Shaju K
What is Pandas?
• • Pandas is an open-source Python library for
data analysis and manipulation.
• • It provides data structures like Series and
DataFrame.
• • Built on top of NumPy for efficient
computations.
Why Use Pandas?
• • Simplifies data cleaning and preprocessing.
• • Facilitates operations like merging,
reshaping, and filtering.
• • Handles large datasets with ease.
Installing Pandas
• Install Pandas using pip:
• ```python
• pip install pandas
• ```

• Verify installation:
• ```python
• import pandas as pd
• print(pd.__version__)
Pandas Data Structures
• • Series: 1D labeled array.
• • DataFrame: 2D labeled data structure (like a
table).
• • Example:
• ```python
• import pandas as pd
• data = pd.Series([1, 2, 3])
• print(data)
• ```
Creating a DataFrame
• Example:
• ```python
• import pandas as pd
• data = {'Name': ['Alice', 'Bob'], 'Age': [25, 30]}
• df = pd.DataFrame(data)
• print(df)
• ```
Reading Data
• Read data from CSV:
• ```python
• df = pd.read_csv('file.csv')
• ```

• Read data from Excel:


• ```python
• df = pd.read_excel('file.xlsx')
• ```
DataFrame Operations
• • Viewing data:
• ```python
• df.head(), df.tail()
• ```
• • Basic info:
• ```python
• df.info(), df.describe()
• ```
Indexing and Selecting Data
• Examples:
• ```python
• df['column_name'] # Select column
• df.loc[0] # Select row by label
• df.iloc[0] # Select row by position
• ```
Data Cleaning
• • Handle missing values:
• ```python
• df.fillna(0), df.dropna()
• ```
• • Drop duplicates:
• ```python
• df.drop_duplicates()
• ```
Sorting Data
• Sort by column:
• ```python
• df.sort_values('column_name')
• ```
• Sort by index:
• ```python
• df.sort_index()
• ```

You might also like