# Questions tagged [numpy]

NumPy is an extension of the Python language that adds support to large multidimensional arrays and matrixes, along with a large library of high-level mathematical functions for operations with these arrays.

87,628
questions

**0**

votes

**1**answer

11 views

### slicing python list beyond its length

I have to slice a Python list/numpy array from an index to -dx and +dx.
where dx is constant. for example:
(the position/index that contains 1 only for illustration, as the center index).
A = [0, 0, 0,...

**1**

vote

**0**answers

10 views

### I need to use numpy's vectorization to optimize my for loop

I have a python function with a nested for loop that is called thousands of times, and is too slow. From what I have read online, there should be a way to optimize it with numpy vectorization so that ...

**0**

votes

**0**answers

3 views

### Reading cvc with numy using features=f.readline().rstrip(“\n”).split(“,”)

When reading a csv file numpy features=f.readline().rstrip("\n").split(",") for the row 1 column 1 I have X1
Output i get ???X1 instead of X1.
Using python 3.9

**0**

votes

**0**answers

11 views

### when I am reading numpy array through tf.io.read_file it show value aka (error failed to convert Tensor)

data = [[1,2,3],[4,5,6]]
data_np = np.asarray(data, np.float32)
tf.io.read_file(data_np)
---------------------------------------------------------------------------
ValueError ...

**0**

votes

**1**answer

17 views

### Plotting the content of numpy arrays in matplotlib

I am trying to plot the content of the arrays x and lj in the following code. However, the point in the plots are not the one inside the arrays. Can someone help me see the mistake I did ? I am still ...

**0**

votes

**0**answers

16 views

### Pandas group by two column with swapped values in other 4 columns

I have a large Pandas DataFrame with many columns. I would like to make sure that Column C and Column E contains value in same order.
For example: If first two rows shows (red and green) & third ...

**0**

votes

**0**answers

20 views

### sending stock prices to discord via python

Hi i am currently working on a project where i show the stock price of a given stock but i want to integrate this funcionality in a discord bot can anybody show me how?
heres the code there are no ...

**0**

votes

**0**answers

3 views

### How to create slices of multiprocessing.sharedctypes.RawArray to build various size 2D matrix

I am using sharedctypes.RawArray for parallel matrix processing in Python and also to pass the array to C code.The code runs in iteration and creates 2D matrices of bigger sizes in each iteration. ...

**0**

votes

**0**answers

17 views

### How can i remove these unwanted columns in my data

I downloaded the data from uci ml repository and pasted it in excel and i was working on that data but i don't know from where some unwanted columns are coming in my data but in my excel sheet of data ...

**0**

votes

**3**answers

27 views

### Split a NumPy array into subarrays according to the values (not sorted, but grouped) of another array

Suppose I have two NumPy arrays
x = [[1, 2, 8],
[2, 9, 1],
[3, 8, 9],
[4, 3, 5],
[5, 2, 3],
[6, 4, 7],
[7, 2, 3],
[8, 2, 2],
[9, 5, 3],
[10, 2, 3],
[...

**0**

votes

**1**answer

28 views

### python : numpy n-array : arranged values

i would like to get an multidimentional array in arr1.shape = (x,y)
which would be filled with values like from np.arange(z), where z is number of spaces in arr1.
it is known that, that i could make
...

**1**

vote

**1**answer

35 views

### In Python, how can I distribute a set of numbers randomly onto a grid/matrix?

I have the following problem:
I want to generate a 100x100 grid (numpy.ndarray) by filling it with numbers, out from a given list ([-1,0,1,2]). I want to distribute them randomly on this grid. Also, ...

**0**

votes

**0**answers

22 views

### Median filter using sort function. (python computer vision)

I created a function to remove noise by making a median filter for RGB images with salt and pepper noise with a filter of size 5
But //m_filter[m2,n2,c1] = padded_image[m2, n2, c1]// I don't know how ...

**0**

votes

**0**answers

9 views

### Converting Perspective Transformed Image Coordinates to Source Image Coordinates

I'm working on line detections. I implement perspective transform to source image and determine line coordinates on transformed image but what i want do is transform this coordinates to my source ...

**2**

votes

**1**answer

32 views

### Transposing values in df?

Imagine having the following df:
Document type Invoicenumber Invoicedate description quantity unit price line amount
Invoice 123 28-08-2020
0 NaN ...