Category "numpy"

Generating list of hexagonal coordinates

I am gonna try to frame this in an understandable way but please let me know if further clarification is necessary. I am trying to create a list of hexagonal co

NRRD File of brain tumor is not being read into python with pynrrd module

I have nrrd files of the brain tumor. When reading the file into an array with a header and passing the code print(filename), I get an array of zeros. I checked

Handwriting detection with keras : using a `tf.Tensor` as a Python `bool` is not allowed in Graph execution

I've tried to run a code example (hosted on keras.io) regarding the handwriting recognition task. While playing with the code, I faced a TensorFlow-related issu

How to understand inaccurate results while using numpy.log?

I wish to calculate the natural logarithm of a value that is very close to 1, but not exactly one. For example, np.log(1 + 1e-22) is 0 and not some non-zero val

IndexError: too many indices for array: array is 0-dimensional, but 2 were indexed

I want to bring in a text file through PyQt5 and draw a graph with data values. import sys from PyQt5.QtWidgets import QApplication, QMainWindow, QTextEdit, QAc

How can fit a keras model with a dataframe of numpy arrays?

I want to train a model with self-generated matrices (word vectors). My data have the following datatypes: print(type(X)) print(type(X[0])) print(type(X[0][0]))

Finding a specific shape position in the Image

I want to Finding a specific shape position in the Image. Firstly, I have a main image like below and I have multiple icons like below. I want to find the posit

Send heavy data through protobuf. Custom field

I'm developing the API for the application using protobuf and grpc. I need to send the data with the arbitrary size. Sometimes it is small, sometimes huge. For

How can I efficiently bin 3D point cloud data based on point coordinates and desired bin grid size

I have a large point cloud in open3D and I want to basically make a 3D grid and bin the points based on which cube they are in. Other have called it "binning in

Numpy array multiplies a constant and passed to cosine fucntion shows abnormal values

I want to lower the frequency of a cosine function with 100 times: import numpy as np import math import matplotlib.pyplot as plt x = np.arange(0, 100, 0.1) y

Replacing a value in a column with a value from the same column based upon information

I am looking for a way to do Missing value imputation. There is a table of entries over a given time, with an entry per hour done on days. There is a seperate

Matlab System Function and Terminal Runs differently

I have a python code that I want to run in Matlab. It has an `import NumPy statement in it. The code runs without a problem in the terminal. But when I use Matl

remove all rows including words (character) in numpy 2d array python

How can I remore words in my 2d array: from: array([['111', 'ACTG1'], ['131', '124'], ['95', '123'], ['95', '124'], ['95', 'ACTG1'],

Why does column + column concatenation create arrays for some Windows accounts?

When running the below Python code, I get different results depending on the user account/admin privileges that is used. The code is saved as test.py on a Windo

Python - Conditional 2D Permutation

Question: How might it be possible to calculate the permutations on a 2D array, but such that the sum of the indicies cannot exceed a certain number? E.g: maxsu

Applying a gradient map from image to another image with transparency in Python (PIL, numpy, etc)

I've been struggling with trying to apply a gradient map which is sourced from an image file to a grayscale image which includes alpha/transparency. The followi

Python: round(random.uniform) printing wrong float value on output console but in background its correct value

See the following code import re import random s = "~|21|050000|voltage|current|ApparentPower|12345~" for _ in range(100): vol_val = round(random.uniform(23

view of a NumPy array with non uniform stride

I have 1D array of N elements. I need to create a PxR view (where PxR<N) on this array according to strides that re not uniform but rather specified in a aux

Avoid interpolating over constraints

Hi I am in the process of interpolating data, but the data from N. America, for example, affect the data from Europe (see figure). I have found out that I must

reading data-frame with missing values

I am trying to read some df with few columns and few rows where in some rows data are missing. For example df looks like this, also elements of the df are separ