Get Started

Loading .npy files

The exercises for this chapter will use a NumPy array holding an image in RGB format. Which image? You'll have to load the array from the mystery_image.npy file to find out!

numpy is loaded as np, and mystery_image.npy is available.

This is a part of the course

“Introduction to NumPy”

View Course

Exercise instructions

  • Load the mystery_image.npy file using the alias f, saving the contents as an array called rgb_array.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Load the mystery_image.npy file 
____

plt.imshow(rgb_array)
plt.show()
Edit and Run Code

This exercise is part of the course

Introduction to NumPy

BeginnerSkill Level
4.8+
59 reviews

Master your skills in NumPy by learning how to create, sort, filter, and update arrays using NYC’s tree census.

NumPy meets the art world in this final chapter as we use image data from a Monet masterpiece to explore how you can use to augment image data. You’ll use flipping and transposing functionality to quickly transform our masterpiece. Next, you’ll pull the Monet array apart, make changes, and reconstruct it using array stacking to see the results.

Exercise 1: Saving and loading arraysExercise 2: Loading .npy files
Exercise 3: Getting helpExercise 4: Update and saveExercise 5: Array acrobaticsExercise 6: Augmenting MonetExercise 7: Transposing your masterpieceExercise 8: Stacking and splittingExercise 9: 2D split and stackExercise 10: Splitting RGB dataExercise 11: Stacking RGB dataExercise 12: Congratulations!

What is DataCamp?

Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.

Start Learning for Free