All Questions
Tagged with numpy python-3.x
10,041
questions
-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 ...
1
vote
0
answers
109
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 ...
0
votes
1
answer
28
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 ...
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 ...
0
votes
1
answer
91
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 ...
12
votes
1
answer
13k
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)
...
0
votes
0
answers
22
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 ...
1
vote
2
answers
7k
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/...
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....
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, ...
1
vote
1
answer
288
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:
---------------------------------------------------------------------------
...
-1
votes
1
answer
36
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 ...
5
votes
1
answer
109
views
Why is unpacking a list in indexing a syntax error in Python 3.8 but not Python 3.12?
The following code
import numpy as np
x = np.arange(32).reshape(2,2,2,2,2)
extra = [1 for _ in range(3)]
print(x[*extra, 0, 0])
prints 28 as expected in Python 3.12 but results in the syntax error
...
2
votes
1
answer
305
views
PyInstaller 1.26.4 -- Numpy Import Error on .exe
When attempting to convert my .py file to a .exe, the conversion goes as planned but when running the .py file I get the following errors:
`Traceback (most recent call last):
File <Filename>,...
0
votes
3
answers
57
views
In Plotting Histogram graph, facing problem in ticks on x-axis
I have generated a histogram graph, graph looks good except the x-axis ticks which are not positioned middle of the bar and sometimes the ticks are randomly placed to the edges or center of the bar.
...