WEBITYA Logo
Back to Articles
Data Science

Assignment 18: NumPy Joining, Stacking & Splitting Arrays | 20 Real-World Practice Questions

This assignment combines everything you have learned so far in NumPy, including array creation, indexing, slicing, reshaping, vectorization, mathematical operations, broadcasting, axis operations, boolean indexing, iteration, sorting, searching, unique values, and joining/splitting arrays.
Aditya Data Scientist
Aditya Data Scientist
1 min
August 4, 2026
Assignment 18: NumPy Joining, Stacking & Splitting Arrays | 20 Real-World Practice Questions

Level 1: A company has sales data of January and February stored in two separate NumPy arrays. Combine both months into a single array using the appropriate NumPy function.

Level 2: A school stores marks of Class A and Class B in two arrays. Combine them so that each class appears in a separate row.

Level 3: An online store stores product IDs in three different arrays received from three warehouses. Merge all product IDs into one array and print the final dataset.

Level 4: Create two 2×3 arrays representing rainfall data collected from two weather stations. Join them horizontally and calculate the total rainfall of each row using the appropriate axis.

Level 5: A hospital stores patient temperature readings collected in the morning and evening in two arrays. Join both datasets vertically and calculate the average temperature of all patients.

Level 6: Create two 2×2 arrays representing the Red and Green color channels of an image. Combine them using np.dstack() and print the resulting 3D array.

Level 7: A company wants to divide its yearly sales data into four quarters. Create a NumPy array of 12 monthly sales values and split it into four equal parts.

Level 8: Create a 4×4 matrix and split it into two equal column groups using np.hsplit(). Print both parts separately.

Level 9: Create a 6×4 matrix representing student marks. Split the matrix into three equal row groups using np.vsplit().

Level 10: Create two arrays containing employee salaries. Join them, then use Boolean Indexing to display only salaries greater than ₹50,000.

Level 11: A supermarket has product prices from two branches. Merge both arrays, sort the prices in ascending order, and display only unique prices.

Level 12: Create two arrays of daily temperatures. Join them and calculate:

  • Maximum temperature
  • Minimum temperature
  • Average temperature
  • Standard deviation

Level 13: Create two arrays of student marks. Join them and display only students who scored 80 or above using Boolean Indexing.

Level 14: A company has monthly profits for two years stored separately. Combine both arrays, reshape the result into a 4×6 matrix, and calculate the yearly total using the correct axis.

Level 15: Create two matrices representing sales from Online and Offline stores. Stack them vertically and calculate the total sales of each store using axis operations.

Level 16: A sensor records data every hour. Create an array of 24 readings, split it into Morning, Afternoon, Evening, and Night, then calculate the average reading of each time period.

Level 17: Create two arrays representing customer IDs from two different databases. Join both arrays, remove duplicate IDs using np.unique(), and display the total number of unique customers.

Level 18: A cricket academy stores runs scored in Practice Match 1 and Practice Match 2. Join both datasets, sort them in descending order, and display only players who scored more than 50 runs.

Level 19: Create a 5×4 matrix of sales data.

Perform the following operations:

  • Display the second column
  • Display the last two rows
  • Split the matrix vertically
  • Join the split parts again
  • Verify that the original matrix is restored

Level 20 (Challenge Project): A company receives monthly sales reports from North, South, East, and West regions.

Write a complete NumPy program that:

  • Creates four monthly sales arrays
  • Joins all regions into one dataset
  • Reshapes the data into a meaningful matrix
  • Calculates total sales for each region
  • Calculates average monthly sales
  • Displays only sales greater than ₹50,000 using Boolean Indexing
  • Sorts all sales values
  • Finds unique sales values
  • Splits the final dataset into two equal halves for Training and Testing
  • Prints every step with proper headings
Share:
#assignment 18#numpy assignment 18#numpy assignment#numpy practice questions#numpy joining arrays#numpy stacking arrays#numpy splitting arrays#numpy concatenate#numpy hstack#numpy vstack#numpy split#numpy hsplit#numpy vsplit#numpy exercises#numpy interview questions#data science assignment#python numpy#learn numpy#numpy tutorial#webitya

Stay Updated

Get the latest insights on AI, Web Development, and Digital Marketing delivered straight to your inbox. Join thousands of developers and marketers.

Weekly Insights

Curated content every week with the latest trends and tutorials

Expert Content

Learn from industry experts and stay ahead of the curve

No Spam

Quality over quantity. Unsubscribe anytime with one click

Secure & Private
8,500+ Subscribers
Weekly Updates