0% found this document useful (0 votes)
2 views9 pages

Python For Data Science - Revision Notes

These notes provide a comprehensive overview of Python for Data Science, organized into key topics for easy revision and practice. It covers fundamental concepts such as Python basics, web scraping, data manipulation with Pandas, and data visualization techniques. Additionally, it includes practical exercises and a complete list of methods and functions used throughout the learning process.

Uploaded by

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

Python For Data Science - Revision Notes

These notes provide a comprehensive overview of Python for Data Science, organized into key topics for easy revision and practice. It covers fundamental concepts such as Python basics, web scraping, data manipulation with Pandas, and data visualization techniques. Additionally, it includes practical exercises and a complete list of methods and functions used throughout the learning process.

Uploaded by

mdasad786kasia
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Python for Data Science – Revision & Practice

Notes
These notes are compiled from your 20 Jupyter notebooks. They are
organized topic-wise for quick revision, practice, and confidence
building. Examples are short and practical.

1. Python Basics & Setup


Covered in: Start_Python.ipynb

Key Concepts
 Variables, data types (int, float, str, bool)
 Lists, tuples, dictionaries, sets
 Conditional statements (if, elif, else)
 Loops (for, while)
 Functions (def, return)
Practice Reminder
 Write a function that takes a list of numbers and returns only even
values.

2. Web Scraping Basics


Covered in: Project1_Web_Scraping.ipynb

Key Concepts
 Fetching data from websites
 Using requests & parsing HTML
 Extracting tables/text for analysis
Typical Workflow
1. Send request to website
2. Parse HTML
3. Extract required data
4. Convert to DataFrame
3. Pandas DataFrame Fundamentals
Creating & Inspecting Data
 pd.read_csv() / read_excel()
 head(), tail(), info(), describe()

4. Filtering DataFrames
Files: Filter DataFrame, query(), isin()

Methods
# Boolean filtering
df[df['Age'] > 25]

# query()
[Link]("Age > 25 & Salary > 50000")

# isin()
df[df['City'].isin(['Delhi','Mumbai'])]

Practice
 Filter rows where category is NOT in a given list

5. Conditional Columns
File: Creating Conditional Column with [Link]()

Concept
Used when there are multiple conditions
conditions = [df['Score'] >= 80, df['Score'] >= 50]
choices = ['A', 'B']
df['Grade'] = [Link](conditions, choices, default='C')

6. Duplicate Data Handling


Files: duplicated(), find duplicate rows

Methods
 duplicated() → marks duplicates
 drop_duplicates() → removes duplicates
Practice
 Remove duplicates based on multiple columns

7. Unique Values & Counts


File: unique() and nunique()
df['City'].unique()
df['City'].nunique()

8. Data Extraction & Cell Updates


Files: Data Extraction, Set New Values

Important Techniques
 .loc[], .iloc[]
 Updating single cells or columns
[Link][0,'Salary'] = 60000

9. Dropping Rows & Columns


File: Drop Rows or Columns
[Link](columns=['Age'])
[Link](index=0)

10. Random Sampling


File: sample()
[Link](n=5)
[Link](frac=0.1)

11. Apply & Lambda Functions


Files: apply(), lambda + apply()

Row / Column Operations


df['Bonus'] = df['Salary'].apply(lambda x: x*0.1)
12. Copying DataFrames
File: copy()
df_copy = [Link]()

Used to avoid SettingWithCopyWarning

13. Reshaping & Pivoting


File: Reshaping and Pivoting

Methods
 pivot()
 pivot_table()
 melt()

14. GroupBy & Aggregations


File: GroupBy and Aggregates
[Link]('Department')['Salary'].mean()

Common aggregations: sum, mean, count, min, max

15. Data Visualization (Static & Interactive)


Files: Project 2, Interactive Visualization

Static
 Line plot
 Bar plot
 Histogram
Interactive
 Pandas built-in interactive plots

16. Mini Revision Checklist


✔ Data loading ✔ Filtering & querying ✔ Cleaning duplicates ✔ Feature
creation ✔ Aggregations ✔ Visualization
How to Practice Effectively
 Re-implement each concept on a new dataset
 Combine filtering + groupby + visualization
 Try explaining each topic out loud (best test!)

✨ You now have a solid Pandas & Data Science foundation. These notes
are meant to be revisited again and again.

Appendix A: Complete List of Methods,


Attributes, Functions & Syntax Used
This section is a full extraction of what you actually used across all 20
notebooks. Use it as a cheat sheet + memory trigger.

A1. Core Python (Basics)


Data Types & Constructors
 int()
 float()
 str()
 list()
 dict()
 set()
 tuple()

Operators
 Arithmetic: + - * / // % **
 Comparison: == != > < >= <=
 Logical: and or not
Control Flow
if condition:
elif condition:
else:

for item in iterable:


while condition:
Functions
def func_name(params):
return value

A2. Libraries Imported


import pandas as pd
import numpy as np
import [Link] as plt

(Also used implicitly in projects: web scraping libraries)

A3. Pandas – DataFrame Creation & Inspection


Reading Data
 pd.read_csv()
 pd.read_excel()

Inspecting Data
 [Link]()
 [Link]()
 [Link]()
 [Link]()
 [Link]
 [Link]
 [Link]

A4. Selecting & Indexing Data


Column Selection
 df['column']
 df[['col1','col2']]

Row / Cell Selection


 [Link][row, col]
 [Link][row, col]

A5. Filtering DataFrames


Boolean Filtering
df[df['Age'] > 25]
query()
[Link]("Age > 25 & Salary > 50000")

isin()
df[df['City'].isin(['Delhi','Mumbai'])]

A6. Conditional Logic on Columns


[Link]()
[Link](df_laptops['Price_euros'] > 2000, 'Expensive', 'Cheap')

[Link]()
[Link](conditions, choices, default=value)

Comparison in Columns
 df['col'] > value
 df['col'] == value

A7. Handling Duplicates


Detecting Duplicates
 [Link]()
 [Link](subset=['col'])

Removing Duplicates
 df.drop_duplicates()
 df.drop_duplicates(subset=['col'])

A8. Unique Values & Counts


 df['col'].unique()
 df['col'].nunique()
 df['col'].value_counts()

A9. Updating & Modifying Data


Set New Values
[Link][row, 'col'] = value
Column Creation
df['new_col'] = values

A10. Dropping Rows & Columns


 [Link](columns=['col'])
 [Link](index=idx)
 [Link]()

A11. Sampling Data


 [Link](n=5)
 [Link](frac=0.1)
 [Link](random_state=42)

A12. apply() & lambda


apply()
df['col'].apply(func)

lambda
df['Bonus'] = df['Salary'].apply(lambda x: x * 0.1)

A13. Copying DataFrames


 [Link]()

A14. Reshaping & Pivoting


Pivot
[Link](index='A', columns='B', values='C')

Pivot Table
df.pivot_table(values='C', index='A', aggfunc='mean')

Melt
[Link](df, id_vars=['A'], value_vars=['B'])
A15. GroupBy & Aggregation
[Link]('col').mean()
[Link]('col')['value'].sum()

Aggregation Functions Used


 sum()
 mean()
 count()
 min()
 max()

A16. Visualization (Pandas & Matplotlib)


Pandas Plotting
 [Link]()
 [Link](kind='bar')
 [Link](kind='line')
 [Link](kind='hist')

Matplotlib
 [Link]()
 [Link]()

A17. Web Scraping (Project)


 Sending HTTP requests
 Parsing HTML
 Extracting tables/text
 Converting scraped data to DataFrame

How to Use This Appendix


 Read → recall → retype from memory
 Try writing 5 examples without looking
 This list alone is enough for daily revision

✅ This appendix represents everything you actually used, not random


Pandas theory.

You might also like