Which method returns all keys of a dictionary?
Anonymous Quiz
12%
A) values()
12%
B) items()
63%
C) keys()
12%
D) get()
❤1
What will be the output?
data = {"a":1, "b":2} data["c"] = 3 print(data)
data = {"a":1, "b":2} data["c"] = 3 print(data)
Anonymous Quiz
9%
A) {'a':1, 'b':2}
66%
B) {'a':1, 'b':2, 'c':3}
18%
C) Error
7%
D) {'c':3}
❤1
Which method is used to remove an element from a dictionary?
Anonymous Quiz
43%
A) remove()
16%
B) delete()
36%
C) pop()
5%
D) clearitem()
❤7
Data Science Roadmap
✅ Python File Handling
🐍📂 File handling allows Python programs to read and write data from files.
👉 Very important in data science because most datasets come as:
✔ CSV files
✔ Text files
✔ Logs
✔ JSON files
🔹 1. Opening a File
Python uses the open() function.
Syntax:
Example:
👉 "r" → Read mode
🔹 2. File Modes
- "r" → Read file
- "w" → Write file (overwrites existing content)
- "a" → Append file (adds to existing content)
- "r+" → Read and write
🔹 3. Reading a File
- Read Entire File:
- Read One Line:
- Read All Lines:
🔹 4. Writing to a File
⚠ "w" will overwrite existing content.
🔹 5. Append to File
✔ Adds content without deleting old data.
🔹 6. Best Practice (Very Important ⭐)
Use with statement.
✔ Automatically closes the file.
🔹 7. Why File Handling is Important?
Used for:
✔ Reading datasets
✔ Saving results
✔ Logging machine learning models
✔ Data preprocessing
🎯 Today’s Goal
✔ Understand file modes
✔ Read files
✔ Write files
✔ Use with open()
👉 File handling is used heavily when working with CSV datasets in data science.
Double Tap ♥️ For More
✅ Python File Handling
🐍📂 File handling allows Python programs to read and write data from files.
👉 Very important in data science because most datasets come as:
✔ CSV files
✔ Text files
✔ Logs
✔ JSON files
🔹 1. Opening a File
Python uses the open() function.
Syntax:
open("filename", "mode")Example:
file = open("data.txt", "r")👉 "r" → Read mode
🔹 2. File Modes
- "r" → Read file
- "w" → Write file (overwrites existing content)
- "a" → Append file (adds to existing content)
- "r+" → Read and write
🔹 3. Reading a File
- Read Entire File:
file.read()- Read One Line:
file.readline()- Read All Lines:
file.readlines()🔹 4. Writing to a File
file = open("data.txt", "w")
file.write("Hello Data Science")
file.close()
⚠ "w" will overwrite existing content.
🔹 5. Append to File
file = open("data.txt", "a")
file.write("\nNew line added")
file.close()
✔ Adds content without deleting old data.
🔹 6. Best Practice (Very Important ⭐)
Use with statement.
with open("data.txt", "r") as file:
content = file.read()
print(content)
✔ Automatically closes the file.
🔹 7. Why File Handling is Important?
Used for:
✔ Reading datasets
✔ Saving results
✔ Logging machine learning models
✔ Data preprocessing
🎯 Today’s Goal
✔ Understand file modes
✔ Read files
✔ Write files
✔ Use with open()
👉 File handling is used heavily when working with CSV datasets in data science.
Double Tap ♥️ For More
❤10
Which function is used to open a file in Python?
Anonymous Quiz
8%
A) file()
62%
B) open()
21%
C) read()
10%
D) openfile()
❤2
❤2
What will the following code do?
file = open("data.txt", "w") file.write("Hello")
file = open("data.txt", "w") file.write("Hello")
Anonymous Quiz
5%
A) Reads file
2%
B) Deletes file
89%
C) Writes text to file
4%
D) Prints file content
❤1
Which method reads the entire file content?
Anonymous Quiz
10%
A) readline()
28%
B) readlines()
59%
C) read()
3%
D) get()
❤1
Why is the with open() statement preferred?
Anonymous Quiz
26%
A) It runs faster
55%
B) It automatically closes the file
4%
C) It deletes the file
15%
D) It prevents writing
❤2👍1🥰1
✅ Python Exception Handling (try–except) 🐍⚠️
Exception handling helps programs handle errors gracefully instead of crashing.
👉 Very important in real-world applications and data processing.
🔹 1. What is an Exception?
An exception is an error that occurs during program execution.
Example:
Output: ZeroDivisionError
This will crash the program.
🔹 2. Using try–except
We use try–except to handle errors.
Syntax:
Example:
Output: Error occurred
🔹 3. Handling Specific Exceptions
✔ Handles only ValueError.
🔹 4. Using else
else runs if no error occurs.
Output: No error
🔹 5. Using finally
finally always executes.
🔹 6. Common Python Exceptions
• ZeroDivisionError: Division by zero
• ValueError: Invalid value
• TypeError: Wrong data type
• FileNotFoundError: File does not exist
🎯 Today's Goal
✔ Understand exceptions
✔ Use try–except
✔ Handle specific errors
✔ Use else and finally
👉 Exception handling is widely used in data pipelines and production code.
Double Tap ♥️ For More
Exception handling helps programs handle errors gracefully instead of crashing.
👉 Very important in real-world applications and data processing.
🔹 1. What is an Exception?
An exception is an error that occurs during program execution.
Example:
print(10 / 0)
Output: ZeroDivisionError
This will crash the program.
🔹 2. Using try–except
We use try–except to handle errors.
Syntax:
try:
# code that may cause error
except:
# code to handle error
Example:
try:
x = 10 / 0
except:
print("Error occurred")
Output: Error occurred
🔹 3. Handling Specific Exceptions
try:
num = int("abc")
except ValueError:
print("Invalid number")
✔ Handles only ValueError.
🔹 4. Using else
else runs if no error occurs.
try:
x = 10 / 2
except:
print("Error")
else:
print("No error")
Output: No error
🔹 5. Using finally
finally always executes.
try:
file = open("data.txt")
except:
print("File not found")
finally:
print("Execution completed")
🔹 6. Common Python Exceptions
• ZeroDivisionError: Division by zero
• ValueError: Invalid value
• TypeError: Wrong data type
• FileNotFoundError: File does not exist
🎯 Today's Goal
✔ Understand exceptions
✔ Use try–except
✔ Handle specific errors
✔ Use else and finally
👉 Exception handling is widely used in data pipelines and production code.
Double Tap ♥️ For More
❤8
SQL, or Structured Query Language, is a domain-specific language used to manage and manipulate relational databases. Here's a brief A-Z overview by @sqlanalyst
A - Aggregate Functions: Functions like COUNT, SUM, AVG, MIN, and MAX used to perform operations on data in a database.
B - BETWEEN: A SQL operator used to filter results within a specific range.
C - CREATE TABLE: SQL statement for creating a new table in a database.
D - DELETE: SQL statement used to delete records from a table.
E - EXISTS: SQL operator used in a subquery to test if a specified condition exists.
F - FOREIGN KEY: A field in a database table that is a primary key in another table, establishing a link between the two tables.
G - GROUP BY: SQL clause used to group rows that have the same values in specified columns.
H - HAVING: SQL clause used in combination with GROUP BY to filter the results.
I - INNER JOIN: SQL clause used to combine rows from two or more tables based on a related column between them.
J - JOIN: Combines rows from two or more tables based on a related column.
K - KEY: A field or set of fields in a database table that uniquely identifies each record.
L - LIKE: SQL operator used in a WHERE clause to search for a specified pattern in a column.
M - MODIFY: SQL command used to modify an existing database table.
N - NULL: Represents missing or undefined data in a database.
O - ORDER BY: SQL clause used to sort the result set in ascending or descending order.
P - PRIMARY KEY: A field in a table that uniquely identifies each record in that table.
Q - QUERY: A request for data from a database using SQL.
R - ROLLBACK: SQL command used to undo transactions that have not been saved to the database.
S - SELECT: SQL statement used to query the database and retrieve data.
T - TRUNCATE: SQL command used to delete all records from a table without logging individual row deletions.
U - UPDATE: SQL statement used to modify the existing records in a table.
V - VIEW: A virtual table based on the result of a SELECT query.
W - WHERE: SQL clause used to filter the results of a query based on a specified condition.
X - (E)XISTS: Used in conjunction with SELECT to test the existence of rows returned by a subquery.
Z - ZERO: Represents the absence of a value in numeric fields or the initial state of boolean fields.
A - Aggregate Functions: Functions like COUNT, SUM, AVG, MIN, and MAX used to perform operations on data in a database.
B - BETWEEN: A SQL operator used to filter results within a specific range.
C - CREATE TABLE: SQL statement for creating a new table in a database.
D - DELETE: SQL statement used to delete records from a table.
E - EXISTS: SQL operator used in a subquery to test if a specified condition exists.
F - FOREIGN KEY: A field in a database table that is a primary key in another table, establishing a link between the two tables.
G - GROUP BY: SQL clause used to group rows that have the same values in specified columns.
H - HAVING: SQL clause used in combination with GROUP BY to filter the results.
I - INNER JOIN: SQL clause used to combine rows from two or more tables based on a related column between them.
J - JOIN: Combines rows from two or more tables based on a related column.
K - KEY: A field or set of fields in a database table that uniquely identifies each record.
L - LIKE: SQL operator used in a WHERE clause to search for a specified pattern in a column.
M - MODIFY: SQL command used to modify an existing database table.
N - NULL: Represents missing or undefined data in a database.
O - ORDER BY: SQL clause used to sort the result set in ascending or descending order.
P - PRIMARY KEY: A field in a table that uniquely identifies each record in that table.
Q - QUERY: A request for data from a database using SQL.
R - ROLLBACK: SQL command used to undo transactions that have not been saved to the database.
S - SELECT: SQL statement used to query the database and retrieve data.
T - TRUNCATE: SQL command used to delete all records from a table without logging individual row deletions.
U - UPDATE: SQL statement used to modify the existing records in a table.
V - VIEW: A virtual table based on the result of a SELECT query.
W - WHERE: SQL clause used to filter the results of a query based on a specified condition.
X - (E)XISTS: Used in conjunction with SELECT to test the existence of rows returned by a subquery.
Z - ZERO: Represents the absence of a value in numeric fields or the initial state of boolean fields.
❤12😁1
✅ NumPy Basics 🐍📊
NumPy (Numerical Python) is the most important library for numerical computing in Python.
It is widely used in:
✔ Data Science
✔ Machine Learning
✔ AI
✔ Scientific computing
🔹 1. What is NumPy?
NumPy provides a powerful data structure called NumPy Array. It is faster and more efficient than Python lists for mathematical operations.
Example:
🔹 2. Creating a NumPy Array
From a List
Output:
🔹 3. Check Array Type
Output:
🔹 4. NumPy Array Operations
Addition:
Output:
Multiplication:
Output:
🔹 5. NumPy Built-in Functions
Output:
🔹 6. NumPy Array Shape
Output:
Meaning: 2 rows and 3 columns.
🔹 7. Why NumPy is Important?
NumPy is the foundation of data science libraries:
✔ Pandas
✔ Scikit-Learn
✔ TensorFlow
✔ PyTorch
All these libraries use NumPy internally.
🎯 Today's Goal
✔ Install NumPy
✔ Create arrays
✔ Perform math operations
✔ Understand array shape
Double Tap ♥️ For More
NumPy (Numerical Python) is the most important library for numerical computing in Python.
It is widely used in:
✔ Data Science
✔ Machine Learning
✔ AI
✔ Scientific computing
🔹 1. What is NumPy?
NumPy provides a powerful data structure called NumPy Array. It is faster and more efficient than Python lists for mathematical operations.
Example:
import numpy as np
🔹 2. Creating a NumPy Array
From a List
import numpy as np
arr = np.array([1, 2, 3, 4])
print(arr)
Output:
[1 2 3 4]
🔹 3. Check Array Type
print(type(arr))
Output:
<class 'numpy.ndarray'>
🔹 4. NumPy Array Operations
Addition:
import numpy as np
arr = np.array([1, 2, 3])
print(arr + 2)
Output:
[3 4 5]
Multiplication:
print(arr * 2)
Output:
[2 4 6]
🔹 5. NumPy Built-in Functions
arr = np.array([10, 20, 30, 40])
print(arr.sum())
print(arr.mean())
print(arr.max())
print(arr.min())
Output:
100
25.0
40
10
🔹 6. NumPy Array Shape
arr = np.array([[1, 2, 3], [4, 5, 6]])
print(arr.shape)
Output:
(2, 3)
Meaning: 2 rows and 3 columns.
🔹 7. Why NumPy is Important?
NumPy is the foundation of data science libraries:
✔ Pandas
✔ Scikit-Learn
✔ TensorFlow
✔ PyTorch
All these libraries use NumPy internally.
🎯 Today's Goal
✔ Install NumPy
✔ Create arrays
✔ Perform math operations
✔ Understand array shape
Double Tap ♥️ For More
❤10👍2
𝗙𝗿𝗲𝘀𝗵𝗲𝗿𝘀 𝗖𝗮𝗻 𝗚𝗲𝘁 𝗮 𝟯𝟬 𝗟𝗣𝗔 𝗝𝗼𝗯 𝗢𝗳𝗳𝗲𝗿 𝘄𝗶𝘁𝗵 𝗔𝗜 & 𝗗𝗦 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻😍
IIT Roorkee offering AI & Data Science Certification Program
💫Learn from IIT ROORKEE Professors
✅ Students & Fresher can apply
🎓 IIT Certification Program
💼 5000+ Companies Placement Support
Deadline: 22nd March 2026
📌 𝗥𝗲𝗴𝗶𝘀𝘁𝗲𝗿 𝗡𝗼𝘄 👇 :-
https://pdlink.in/4kucM7E
Big Opportunity, Do join asap!
IIT Roorkee offering AI & Data Science Certification Program
💫Learn from IIT ROORKEE Professors
✅ Students & Fresher can apply
🎓 IIT Certification Program
💼 5000+ Companies Placement Support
Deadline: 22nd March 2026
📌 𝗥𝗲𝗴𝗶𝘀𝘁𝗲𝗿 𝗡𝗼𝘄 👇 :-
https://pdlink.in/4kucM7E
Big Opportunity, Do join asap!
❤3
What does NumPy stand for?
Anonymous Quiz
81%
A) Numerical Python
5%
B) Number Python
11%
C) Numeric Program
2%
D) None
❤3
Which function is used to create a NumPy array?
Anonymous Quiz
4%
A) np.list()
89%
B) np.array()
7%
C) np.create()
0%
D) np.make()
❤5
What will be the output?
import numpy as np arr = np.array([1, 2, 3]) print(arr + 1)
import numpy as np arr = np.array([1, 2, 3]) print(arr + 1)
Anonymous Quiz
6%
A) [1 2 3]
71%
B) [2 3 4]
5%
C) [1 3 4]
18%
D) Error
❤4
What will be the output?
arr = np.array([10, 20, 30]) print(arr.mean())
arr = np.array([10, 20, 30]) print(arr.mean())
Anonymous Quiz
65%
A) 20
24%
B) 30
6%
C) 10
5%
D) Error
❤3
What does arr.shape return?
Anonymous Quiz
12%
A) Total elements
9%
B) Data type
75%
C) Dimensions of array
5%
D) Sum of array
❤5
📢 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗔𝗹𝗲𝗿𝘁 – Data Analytics with Artificial Intelligence
Upgrade your career with AI-powered data science skills.
*Open for all. No Coding Background Required*
📊 Learn Data Analytics with Artificial Intelligence from Scratch
🤖 AI Tools & Automation
📈 Build real world Projects for job ready portfolio
🎓 E&ICT IIT Roorkee Certification Program
🔥Deadline :- 22nd March
𝗔𝗽𝗽𝗹𝘆 𝗡𝗼𝘄 👇 :- https://pdlink.in/4tkErvS
Don't Miss This Opportunity. Get Placement Assistance With 5000+ Companies
Upgrade your career with AI-powered data science skills.
*Open for all. No Coding Background Required*
📊 Learn Data Analytics with Artificial Intelligence from Scratch
🤖 AI Tools & Automation
📈 Build real world Projects for job ready portfolio
🎓 E&ICT IIT Roorkee Certification Program
🔥Deadline :- 22nd March
𝗔𝗽𝗽𝗹𝘆 𝗡𝗼𝘄 👇 :- https://pdlink.in/4tkErvS
Don't Miss This Opportunity. Get Placement Assistance With 5000+ Companies
❤1