Numpy matrix.take () method, we can select elements from a given matrix by passing a parameter as the index value of that element. It will return a matrix that has one dimension. Remember this will work for one axis at a time.
matrix.take (index, axis)
Return: Return matrix of selected indexes
Example # 1:
In this example, we we see that by choosing one index, we get only one value in the matrix using
matrix.take () .
Output: p >
Example # 2:
code > Exit:
# import an important module into python
numpy as np
# make a matrix with NumPy
gfg code >
`[4, 1, 9; 12, 3, 1; 4, 5, 6] `
# using the matrix.take () method
= code >
[[4 12 4]]
code > Exit:
Computer Age Statistical Inference: Algorithms, Evidence, and Data Science (Institute of Mathematical Statistics Monographs, Series Number 6). The twenty-first century has seen a breathtaking expan...
Learning Correct Cryptography by Example. The interconnected world of the current era has drastically changed everything, including banking, entertainment, and even statecraft. Despite difference...
This book serves as a practical guide on how to utilize big data to store, process, and analyze structured data, focusing on three of the most popular Apache projects in the Hadoop ecosystem: Apache S...
Python Workout isn’t designed to teach you Python, although I hope and expect that you’ll learn quite a bit along the way. It is meant to help you improve your understand- ing of Python and how to...