ML-LAB-VI-SEM

Exercise 01

Study of Python Basic Libraries such as NumPy and SciPy

Aim

To understand and experiment with basic functionalities of Python libraries NumPy and SciPy.

Procedure/Program

NumPy Example

import numpy as np

arr = np.array([[1, 2, 3], [4, 5, 6]])
print("NumPy Array:\n", arr)

# basic operations
print("Shape of array:", arr.shape)
print("Sum of all elements:", np.sum(arr))
print("Mean of elements:", np.mean(arr))
print("Transpose of array:\n", arr.T)

SciPy Example

from scipy import stats
import numpy as np

data = [12, 15, 14, 10, 18, 14, 17, 16, 15, 15]

mean = np.mean(data)
median = np.median(data)
mode = stats.mode(data)

print("Mean:", mean)
print("Median:", median)
print("Mode:", mode.mode)

Output/Explanation