Image

Mon 30 June 2025
pip install opencv-python
Requirement already satisfied: opencv-python in c:\users\hp\miniconda3\envs\py312\lib\site-packages (4.11.0.86)
Requirement already satisfied: numpy>=1.21.2 in c:\users\hp\miniconda3\envs\py312\lib\site-packages (from opencv-python) (2.3.1)
Note: you may need …

Category: basics

Read More

Iris

Mon 30 June 2025
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
iris = load_iris()
df = pd.DataFrame(iris.data, columns=iris.feature_names)
df['species'] = iris.target
df['species'] = df['species'].map(dict(enumerate(iris.target_names)))
df.head()

Category: basics

Read More

Loan

Mon 30 June 2025
# Block 1: Import libraries
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
# Block 2: Load the dataset
df = pd.read_csv("https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv")
df = df.rename(columns={"Sex": "Gender", "Age": "ApplicantIncome", "Fare": "LoanAmount"})
df = df …

Category: basics

Read More

Matplot

Mon 30 June 2025
import matplotlib.pyplot as plt
x = [1, 2, 3, 4]
y = [10, 20, 25, 30]
plt.plot(x, y)
plt.title('Basic Line Plot')
plt.show()

png

plt.plot(x, y, color='red', marker='o', linestyle='--', linewidth=2)
plt.grid(True)
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.show()

png

categories = ['A …

Category: basics

Read More

Mega1

Mon 30 June 2025
# Topic: Decorators
def log(func):
 def wrapper():
  print('Call')
  func()
 return wrapper
@log
def say(): print('Hi')
say()
# Topic: Decorators
def log(func):
 def wrapper():
  print('Call')
  func()
 return wrapper
@log
def say(): print('Hi')
say()
# Topic: NumPy
import numpy as np
a = np.array([1, 2, 3])
print(a …

Category: basics

Read More

Mega2

Mon 30 June 2025
# Topic: Lists & Tuples
lst = [1, 2, 3]
lst.append(4)
print(lst)
# Topic: OOP
class Student:
    def __init__(self, name): self.name = name
s = Student('Fahd')
print(s.name)
# Topic: Recursion
def fact(n): return 1 if n==0 else n*fact(n-1)
print(fact(5))
# Topic: Functions
def square …

Category: basics

Read More

Meganotes 4

Mon 30 June 2025
# Topic: Recursion
def fact(n): return 1 if n==0 else n*fact(n-1)
print(fact(5))
# Topic: OOP
class Student:
    def __init__(self, name): self.name = name
s = Student('Fahd')
print(s.name)
# Topic: Web Scraping
import requests
from bs4 import BeautifulSoup
r = requests.get('https://example.com')
soup …

Category: basics

Read More

Movies

Mon 30 June 2025
import matplotlib.pyplot as plt
movies = [
    {"title": "Inception", "rating": 8.8},
    {"title": "Interstellar", "rating": 8.6},
    {"title": "The Dark Knight", "rating": 9.0},
    {"title": "Tenet", "rating": 7.5},
    {"title": "Dunkirk", "rating": 7.9}
]
# Create DataFrame
import pandas as pd
df = pd.DataFrame(movies)
df

Category: basics

Read More

Note003

Mon 30 June 2025
# Topic: NumPy
import numpy as np
print(np.arange(0, 10, 2))
# Topic: Dictionaries & Sets
s = {1,2,3}
s.add(4)
print(s)
# Topic: Matplotlib
import matplotlib.pyplot as plt
plt.bar(['A','B'], [10,20])
plt.show()
# Topic: Exceptions
try:
    print(10/0)
except ZeroDivisionError:
    print('Cannot divide …

Category: basics

Read More

Notes002

Mon 30 June 2025
# Topic: Pandas
import pandas as pd
df = pd.DataFrame({'A':[1,2],'B':[3,4]})
print(df)
# Topic: Web Scraping
import requests
from bs4 import BeautifulSoup
r = requests.get('https://example.com')
soup = BeautifulSoup(r.text, 'html.parser')
print(soup.title.string)
# Topic: Lists & Tuples
nums = [1,2,3]
nums …

Category: basics

Read More
Page 2 of 5

« Prev Next »