Tag: numpy-ndarray

62 votes
16 answers
1.9K views
Better way to shuffle two numpy arrays in unison

I have two numpy arrays of different shapes, but with the same length (leading dimension). I want to shuffle e

avatar
Wilfredo
0 1 0 9
asked 07 September, 2021
53 votes
5 answers
2.6K views
What is the difference between ndarray and array in numpy?

What is the difference between ndarray and array in Numpy? And where can I find the implementations in the num

avatar
Majorie
0 1 0 9
asked 07 September, 2021
58 votes
6 answers
1.9K views
Concatenating two one-dimensional NumPy arrays

I have two simple one-dimensional arrays in NumPy. I should be able to concatenate them using numpy.concatenat

avatar
Hilario
0 1 0 9
asked 07 September, 2021
62 votes
8 answers
1.2K views
How to convert a PIL Image into a numpy array?

Alright, I'm toying around with converting a PIL image object back and forth to a numpy array so I can do

avatar
Basil
0 1 0 9
asked 07 September, 2021
54 votes
3 answers
2.6K views
What is the difference between flatten and ravel functions in numpy?

import numpy as np y = np.array(((1,2,3),(4,5,6),(7,8,9))) OUTPUT: print(y.flatten()) [1 2 3 4 5 6

avatar
Arline
0 1 0 9
asked 07 September, 2021
69 votes
7 answers
442 views
What is the purpose of meshgrid in Python / NumPy?

Can someone explain to me what is the purpose of meshgrid function in Numpy? I know it creates some kind of gr

avatar
Yolando
0 1 0 9
asked 07 September, 2021
65 votes
5 answers
2.6K views
What are the advantages of NumPy over regular Python lists?

What are the advantages of NumPy over regular Python lists? I have approximately 100 financial markets series

avatar
Emilia
0 1 0 9
asked 07 September, 2021
68 votes
11 answers
1.3K views
What does -1 mean in numpy reshape?

A numpy matrix can be reshaped into a vector using reshape function with parameter -1. But I don't know w

avatar
Sena
0 1 0 9
asked 07 September, 2021
51 votes
20 answers
2.3K views
How do I get indices of N maximum values in a NumPy array?

NumPy proposes a way to get the index of the maximum value of an array via np.argmax. I would like a similar

avatar
Lynette
0 1 0 9
asked 07 September, 2021