Questions tagged [NumPy] (49)

2
answers

Due to what NumPy arrays are Python lists effectiveness?

Everywhere it is written that the NumPy arrays are faster and more efficient than lists. Why this is so, they have some kind of more optimal implementation or write, due to the fact that arrays have many useful and convenient features that are effectively written?
Major.Hodkiewi asked April 18th 20 at 12:17
1
answer

How to speed up np.dot()?

Colleagues, kind time of day! Interested in the following: I get from DB df $ 10 million rows by n columns; Then choose from this df one column; Make a copy of it consists of the inverse values; Received a copy of the make line; Then multiply by matrix method using np.dot()column on the generated string. -------------------...
bethany.Rat asked April 9th 20 at 10:31
1
answer

Do not work out a method of drawing a segment, what's wrong?

Hello, solve the problem of drawing the fractal,namely the Gosper curve, has the following methods: class turtle: def __init__(self): self._direction = np.array([1, 0]) # 2D direction vector self._position = np.array([0, 0]) # the 2D position vector def forward(self): pos = self._position dirn = self._direction self....
maye.Schmi asked April 9th 20 at 10:24
1
answer

How to get the indices of maximal elements in the array of NumPy arrays?

There is an array of the following form: (items in red are the largest elements whose indexes have to) That is, for such a array the code should return something like this: (0, 2, 2), (1, 0, 1), (2, 1, 0), (3, 0, 0), (4, 0, 0) Of course you can do a cycle with np.argmax, but maybe someone will be able to find a more effe...
fabian20 asked April 9th 20 at 10:07
1
answer

How to download the results of calculations from Python to Oracle?

Good day, Faced with such a situation: a bunch of articles on how to using python to connect to Oracle (cx_Oracle) to get data from a DB and then how to add back to the database data — the answer is not found. All the calculations I gather in the format of pd.DataFrame Please help if anyone solved a similar problem or hav...
joanie.Johnson asked April 8th 20 at 18:01
1
answer

Why not work a structured NumPy array?

That's why this piece of code tpl=('07f29c2c-9bd2-4999-b69c-a17d15a90700', datetime.datetime(2019, 8, 18, 0, 0), datetime.datetime(2019, 8, 18, 13, 3, 56), datetime.timedelta(seconds=31), datetime.datetime(2019, 8, 18, 13, 4, 27), 57) dt = np.dtype([('v2m_guid', str, 36), ('start_date', 'datetime64[ns]'), ('start_time', '...
kara_Dicki37 asked April 8th 20 at 10:16
1
answer

How to get the vector-column, consisting of the derivative of one column of the array in another column?

there is a two-dimensional array 0.0, 1 1.0, 2 2.0, 3 2.5, 4 How to get the vector-column, consisting of the derivative of the second column to the first? 0 1 1 2 Or 1 1 2
eunice59 asked April 8th 20 at 10:14
1
answer

How to put a numpy array to a numpy array?

I have this problem: I need to go to class to pass one-dimensional array with numbers, and class should be created in a single numpy array many arrays, how many items and one-dimensional which we passed, and with the dimension of each element as quickly as possible. Example: class Net(): def __init__(self, input_list): se...
Daphney.Deckow asked April 7th 20 at 11:47
1
answer

Machine generation of artistic patterns in vector fields?

Trying to rewrite this article: Machine learning only began to study, hence the following question arises: How to build a grid of angles and bring it through PyCharm? I am at this stage: import numpy as np import math import matplotlib.pyplot as plt width = 100 height = 100 left_x = int(width * -0.5) right_x = int(width...
Craig asked April 7th 20 at 11:13
1
answer

How to draw a lot of lines in matplotlib with numpy 2d array?

There are 2 single 2d array with the x-mi the other with y-mi lines. For example, x=np.array([[1,2,3], [4,5,6]]) y=np.array([[11,22,33], [44,55,66]]), how to render as fast as possible
hazle.Denesik asked April 7th 20 at 09:35