# Questions tagged [numpy]

NumPy is a scientific and numerical computing extension to the Python programming language.

54,881 questions

**0**

votes

**1**answer

20 views

### Cropping image in numpy array

I want to crop RGB images such that the upper half part of the image is removed. After cropping I want to concatenate the image to a numpy array (here images). But I get the following error ValueError:...

**0**

votes

**0**answers

7 views

### How to load .mtx file in NetworkX?

I have a graph in Matrix Market Exchange Format (.mtx). Format details are available in https://math.nist.gov/MatrixMarket/formats.htmlI want to load the graph in NetworkX for graph analytics ...

**0**

votes

**0**answers

18 views

### Plot time series with discontinous interval

I'm trying to plot some data. The data is a list of tuples (date, value), sorted by date. This list is created from a list of dictionaries that is not ordered by date and the interval covered is not ...

**0**

votes

**0**answers

26 views

### How to convert a list of arrays into a single array [duplicate]

I have a list of Numpy arrays that looks like this:print(data)[400.31865662][401.18514808][404.84015554][405.14682194][405.67735105][273.90969447][274.0894528]Now I would like to convert ...

**0**

votes

**1**answer

29 views

### Replace value from dataframe with other dataframe value, based on 2 equality conditions [duplicate]

I was trying to find a solution but couldn't get there.I have 2 data frames, one large one with a few thousand records and another with just a few rows that are exceptions - let's call it A and B ...

**-3**

votes

**1**answer

48 views

### How to convert Numpy array to Panda DataFrame

I have a Numpy array that looks like this:[400.31865662][401.18514808][404.84015554][405.14682194][405.67735105][273.90969447][274.0894528]When I try to convert it to a Panda Dataframe with ...

**0**

votes

**2**answers

36 views

### Why does SciPy's curve_fit function care about the type of xdata?

I was trying to fit some data using SciPy's curve_fit and got really weird results. So I tried and tried and tested and found the issue in the type of xdata. When xdata is of type int, the results ...

**0**

votes

**1**answer

25 views

### numpy - Multidimensional boolean mask

I'm quite new to Python and numpy and I just cannot get this to work without manual iteration.I have an n-dimensional data array with floating point values and an equally shaped boolean "mask" array....

**0**

votes

**1**answer

14 views

### Reshaping a batch for LSTM in Keras

I am trying to build an LSTM AutoEncoder but I am facing some problems in the data shaping process due to fit LSTM needs. Since I am training on batches I generate within a loop of windows of my time ...

**2**

votes

**2**answers

73 views

### Finding top N values for each group, 200 million rows

I have a pandas DataFrame which has around 200 million rows and looks like this:UserID MovieID Rating1 455 52 411 41 288 22 300 32 137 5...

**0**

votes

**0**answers

28 views

### fft numpy style on iOS accelerate with non power of two data length

I'm working on reimplementing python code on iOS (swift). I need to do an fft (numpy style) on chunks of 1D data. each with size 1050 (windowed audio data).Thankfully I found related explanation ...

**0**

votes

**0**answers

27 views

### Merging Corresponding Elements into one List from a method returning value

How to sort the data in a list; before they are stacked into another list in accordance to their inserted elements?list=[]dictionary={}def MethodA():#searches for corresponding data using ...

**1**

vote

**1**answer

19 views

### Why does this TensorFlow snippet throw an error in feeding?

Code#!/usr/bin/env python3import tensorflow as tfimport numpy as npdef customOps(n):x=tf.placeholder(tf.float32)v1=tf.reduce_sum(x,1)v2=tf.reduce_sum(x,0)v=tf.nn.softmax(tf....

**1**

vote

**2**answers

47 views

### Efficient implementation to check: for each element in array check if it exists in another array

I have two large 1d numpy arrays in the range of 400K elements. I need to check for each element in array A if it exists in array B. I used in1d but it seems to be too slow and takes a lot of time. I ...

**3**

votes

**2**answers

63 views

### How to go through an array apply a threshold to each pixel

I have a 3 channel numpy array and I would like to apply a function to each pixel. Specifically I want to process an image and return a greyscale image highlighting where specific colours appear in ...