Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
1 vote
0 answers
20 views

pycharm Unresolved attribute reference 'astype' for class 'ndarray'

Q: How can I fix the bug where Pychram warns about numpy.ndarray attributes? The code runs with no problem, however pycharm keeps giving this warning Unresolved attribute reference 'astype' for class '...
Electron X's user avatar
1 vote
1 answer
31 views

Using multiprocessing Pool with a function that takes a list of arrays

I am trying to write a function to read a large number of files in parallel. The code I have for this goes like: import numpy as np from multiprocessing import Pool from functools import partial def ...
Saurabh's user avatar
  • 55
0 votes
0 answers
37 views

Vectorization of power law fitting

I am moving a code base to run using PyTorch tensor on GPU. For loops are terrible on GPU especially for small-sized data. I am trying to vectorize the function below, i.e. to have no for loops. I ...
David's user avatar
  • 37
-3 votes
0 answers
20 views

how can I compute the striking force of a football player using python [closed]

in a football match between England and Spain Julius Fueke needs a decisive goal, write a Python program that can compute the striking force of each of the players i tried using the import numpy but ...
yagi's user avatar
  • 1
2 votes
0 answers
278 views

ModuleNotFoundError: No module named 'numpy._core'

I am trying to load a .npy file created on my local PC with np.save() in google colaboratory. However, when I try to open it on Google Colab with np.load() I get this error: ModuleNotFoundError: No ...
tymerius's user avatar
0 votes
1 answer
33 views

Why are my dimensions different when using OpenAi embeddings in Python?

I have a single Python function that I am using the embed JSON objects are different lengths. The issue I am having is that, somehow, the dimensions are different when comparing the vectors and I ...
Ken Tola's user avatar
1 vote
1 answer
57 views

In Python with numpy, how to get uniformly distributed random floats between 0 and a natural x, including both?

In Python with numpy, for a given natural number x, we'd like to get an array (say, 20×2 or whichever shape you wish) of uniformly distributed floats in the interval [0,x]. Notice that the interval is ...
AlMa1r's user avatar
  • 125
0 votes
1 answer
92 views

How to make python code fast for minimization?

The following code for minimization of a mechanical system works with no error. However, it is slow and to me there are unnecessary steps or loops that make it heavy! Would you make comment, and ...
Amir H. Fatollahi's user avatar
13 votes
1 answer
15k views

ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

MRE pip install pandas==2.1.1 numpy==2.0.0 Python 3.10 on Google Colab Output Collecting pandas==2.1.1 Downloading pandas-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.3 MB) ...
Free Palestine's user avatar
0 votes
0 answers
24 views

How does catboost handle np.inf values during training?

I want to know how how catboost handles np.inf values during training? Are they ignored completely or are they treated as a separate value/category? Can training a model on data that contains np.inf ...
Giorgi Mosulishvili's user avatar
1 vote
2 answers
8k views

A module that was compiled using NumPy 1.x cannot be run in NumPy 2.0.0

I installed numpy 2.0.0 pip install numpy==2.0.0 import numpy as np np.__version__ #2.0.0 then I installed: pip install opencv-python Requirement already satisfied: opencv-python in /usr/local/lib/...
Free Palestine's user avatar
1 vote
1 answer
39 views

Select multiple columns from array, multiple times

Hi I have the following setup: from scipy def _bootstrap_resample(sample, n_resamples=None, random_state=None): """Bootstrap resample the sample.""" n = sample....
Revist's user avatar
  • 195
0 votes
0 answers
16 views

Multirow subplots with numpy arrays, AttributeError: 'numpy.ndarray' object has no attribute 'hist' [duplicate]

I've been attempting to create a 2-by-2 grid of plots using matplotlib. My data are numpy arrays, and I am trying to create histograms of the data. However, when I format subplots to output two rows, ...
David A. Lee's user avatar
1 vote
1 answer
329 views

module 'numpy' has no attribute 'bool'

Newer version of numpy doesn't allow me to use pandas. Importing pandas into my code gives me the following error: --------------------------------------------------------------------------- ...
Arnav Garg's user avatar
-1 votes
1 answer
39 views

Pytorch - sending dataset to cuda breaks the dataloader iterator - TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu()

I am trying to speed up my pytorch training by following the advice from here: https://discuss.pytorch.org/t/cpu-faster-than-gpu/25343/12 So now, I am sending my trainingdata.data and .targets to cuda ...
Fred E's user avatar
  • 128

15 30 50 per page
1
2 3 4 5
670