Wednesday, November 19, 2025

✅ INTERMEDIATE LEVEL NumPy Projects

 Link for :

ADVANCED LEVEL NumPy Projects

1.Weather Data Simulation

Description:
Simulate 365 days of temperature data using normal distribution and analyze it.

Concepts: Random, mean, std

Code:

import numpy as np temps = np.random.normal(30, 5, 365) print("Average Temp:", temps.mean()) print("Max Temp:", temps.max()) print("Min Temp:", temps.min())

Output::--
Average Temp: 30.00229934869199 Max Temp: 44.1532483791829 Min Temp: 12.372748506925145

2. Image Processing (Convert Image to Grayscale)

Description:
Use NumPy to convert an image to grayscale (conceptual level).

Concepts: Array manipulation

Code:

import numpy as np from PIL import Image img = Image.open("sample.jpg") img_arr = np.array(img) gray = np.dot(img_arr[...,:3], [0.2989, 0.5870, 0.1140]) print(gray)

Output::--
[[242.763 242.763 242.763 ... 254.9745 254.9745 254.9745] [242.763 242.763 242.763 ... 254.9745 254.9745 254.9745] [242.763 242.763 242.763 ... 254.9745 254.9745 254.9745] ... [ 0. 61.5638 204.7217 ... 254.9745 254.9745 254.9745] [ 0. 61.5638 204.7217 ... 254.9745 254.9745 254.9745] [ 0. 61.5638 204.7217 ... 254.9745 254.9745 254.9745]]

3. Matrix Calculator (Add, Multiply, Inverse)

Description:
Perform matrix operations like addition, multiplication, determinant, and inverse.

Concepts: linalg (linear algebra)

Code:

import numpy as np A = np.array([[2, 3], [1, 4]]) B = np.array([[1, 0], [2, 5]]) print("Addition:\n", A + B) print("Multiplication:\n", A.dot(B)) print("Determinant of A:", np.linalg.det(A)) print("Inverse of A:\n", np.linalg.inv(A))

Output::-
Addition: [[3 3] [3 9]] Multiplication: [[ 8 15] [ 9 20]] Determinant of A: 5.000000000000001 Inverse of A: [[ 0.8 -0.6] [-0.2 0.4]]

No comments:

Post a Comment

Python Viva Questions

  Basic Python Viva Questions 1. What is Python? Python is a high-level, interpreted, and object-oriented programming language used for w...