Tp2 Fondamental Data Science
Tp2 Fondamental Data Science
Exercise 1:
Set up tools (Python, Anaconda…etc.) or use online notebooks.
Exercise 2: getting started with Numpy.
Run at least 2 tasks from each category of the next:
Array Creation and Manipulation:
Create a 1D array with values ranging from 0 to 9.
Create a 2D array with shape (3, 4) filled with zeros.
Create an array with 10 equally spaced values between 0 and 1.
Create a random 3x3 matrix with values between 0 and 1.
Create an array with all even integers between 10 and 50.
Create a 5x5 identity matrix.
Create an array with 20 logarithmically spaced values between 1 and 100.
Reshape a 1D array into a 2D array of shape (2, 5).
Transpose a 2D array.
Extract all odd numbers from an array using boolean indexing.
Array Operations:
Add two matrices element-wise.
Multiply two matrices using matrix multiplication.
Calculate the mean, median, and standard deviation of an array.
Find the sum of each column in a 2D array.
Calculate the dot product of two 1D arrays.
Normalize the values in an array between 0 and 1.
Find the index of the maximum value in an array.
Replace all negative values in an array with zeros.
Calculate the element-wise product of two arrays.
Calculate the element-wise square root of an array.
Indexing and Slicing:
Slice a 2D array to extract the second column.
Get the diagonal elements of a 2D array.
Select rows from a 2D array where the sum of elements is greater than a threshold.
Reverse the rows of a 2D array.
Get the elements at odd indices of a 1D array.
Random Number Generation:
Generate an array of 10 random integers between 1 and 100.
PW2 ESTIN 2024-2025
Exercise 3:
V= [0.5, 0.8, 0.9]
M = [1.0, 0.3, 0.65; 0.5, 0.8, 0.9; 1.0, 0.3, 0.65]
Using NumPy:
PW2 ESTIN 2024-2025