← Back to Dashboard

Intro Data Science NumPy Pandas: Medium Exercises MEDIUM

"""
Topic 08: Introduction to Data Science (NumPy & Pandas) - MEDIUM Exercises (10)
"""

# Exercise 1: NumPy Indexing - Create a 5x5 matrix with values from 1 to 25. 
# Extract the submatrix from the middle (rows 2-4 and columns 2-4).
# Write your code below:


# Exercise 2: Boolean Indexing - Create a NumPy array of 10 random integers between 1 and 100. 
# Print all values that are greater than 50.
# Write your code below:


# Exercise 3: Vector Math - Create two NumPy arrays A = [1, 2, 3] and B = [4, 5, 6]. 
# Compute the dot product of A and B.
# Write your code below:


# Exercise 4: Column Operations - Create a Pandas DataFrame with student names and their scores in 3 subjects. 
# Add a new column 'Total' which is the sum of the three subject scores.
# Write your code below:


# Exercise 5: Filtering - From the student DataFrame, select only the students who scored more than 80 in 'Total'.
# Write your code below:


# Exercise 6: Handling Missing Data - Create a DataFrame with some NaN values. 
# Fill all NaNs with the mean of the column.
# Write your code below:


# Exercise 7: Value Counts - Create a Series with categorical data (e.g., ["Red", "Blue", "Red", "Green", "Blue"]).
# Count how many times each color appeared.
# Write your code below:


# Exercise 8: GroupBy - Create a DataFrame with "Department" and "Salary". 
# Find the average salary per department using .groupby().
# Write your code below:


# Exercise 9: Sorting - Create a DataFrame and sort it by two columns: first by 'Age' (ascending) 
# and then by 'Score' (descending).
# Write your code below:


# Exercise 10: NumPy Broadcast - Multiply a 3x3 matrix by a 1D array of 3 elements using broadcasting.
# Write your code below: