Description
In this tutorial, you'll learn everything you need to know to get up and running with NumPy, Python's de facto standard for multidimensional data arrays. NumPy is the foundation for most data science ...
Summary
- NumPy is a Python library that provides a simple yet powerful data structure: Because of the particular calculation in this example, it makes life easier to have integers in the numbers array.
- 7averages=img.mean(axis=2)# Take the average of each R, G, and B 8mpimg.imsave("bad-gray.jpg",averages,cmap="gray") These new lines create a new array called averages, which is a copy of the img array that you’ve flattened along axis 2 by taking the average of all three channels.
- Conclusion No matter how many dimensions your data lives in, NumPy gives you the tools to work with it.