Questions tagged [numpy]
NumPy is one of the many modules in Python that adds support of large multidimensional arrays and matrixes, along with a large library of high-level mathematical functions for operations with these arrays.
numpy
114,403
questions
-4
votes
1
answer
24
views
An ordinary numpy array produces a type error? [closed]
Could someone explain why I get this warning
<>:18: SyntaxWarning: list indices must be integers or slices, not tuple; perhaps you missed a comma?
and this error message
TypeError ...
0
votes
0
answers
10
views
Synthetic Data Vault MultiTableMetadata and get_column_pair_plot
I need help about using get_column_pair_plot because I have difficulty on understanding how to use MultiTableMetadata. Consider the following data :
import numpy as np
import pandas as pd
from sdv....
0
votes
0
answers
19
views
Python3 skglm - 'Poisson' object has no attribute 'get_lipschitz'
Im working with count data and want to fit a poisson regression with a L1 norm. I have the following code which throws the error and is reproducable:
import numpy as np
import skglm
import sklearn
X =...
-4
votes
0
answers
21
views
Runtime overflow in jupyter notebook [closed]
I was calculating the gradient descent when i encountered this problem
RuntimeWarning: overflow encountered in add theta1_slope = (-2/n) + sum(y - thetas[1]*x)*x)
How to resolve it?
1
vote
0
answers
34
views
How to solve a linear rectangular matrix equation over mod 2 in python?
I am trying to solve a linear matrix equation of the AX = B using python, where A,B,X are binary matrices i.e. over GF(2) :
A = np.array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
[0, 0, 0, 0, 0, 0, 0, ...
0
votes
1
answer
38
views
AttributeError: `np.string_` was removed in the NumPy 2.0 release. Use `np.bytes_` instead.. Did you mean: 'strings'?
I m interested in seeing neural network as graph using tensorboard. I have constructed a network in pytorch with following code-
import torch
BATCH_SIZE = 16
DIM_IN = 1000
HIDDEN_SIZE = 100
DIM_OUT = ...
1
vote
0
answers
57
views
How to find the slope of the lower region in any curve?
Github link to txt file`So I have a project , of which the data are of atomic force microscopy. I have two values d = distance and f = force plotted on a normal x-y graph. So there will curves of ...
0
votes
0
answers
43
views
Strange NumPy output in PyCharm
I'm compiling the exact same code in PyCharm and in CMD, but they're giving me two different outputs:
PyCharm output - [np.float64(1.6000000000000003), -1]
CMD output - [1.6000000000000003, -1]
I ...
-2
votes
0
answers
26
views
How do I resolve this .lower() attribute error when calling it with tokenizer function within my code using tensorflow?
I wish to run sum code using the tokenizer function that calls a .lower() module on some texts, but the result is an attribute error as follows:
.vocabulary.update(tokenizer.tokenize(text.numpy()....
0
votes
0
answers
13
views
Problems with FOR loops and iteration [duplicate]
I'm trying to perform a simple mathematical calculation but quanties are changing inside a while loop while only being read and it's baffling me. A similar thing happened inside a for loop too. I'll ...
1
vote
0
answers
53
views
Optimize loops in Numpy correlation matrices
I have a piece of code to calculate price sensitivity based on the product and its rating.
Below is the original data set with product type, reported year, customer’s rating, price per unit, and ...
0
votes
1
answer
70
views
Python: Multiprocessing took longer than sequential, why?
I have this code, it generates 2,000,000 points uniformly distributed in a bounding box and does some calculations to partition the points based on some criteria.
import numpy as np
from draw import ...
0
votes
0
answers
60
views
Add new rows to dataset in nested for loop
The following script works when data4 is used to create dataframe, hours_date_match_barc. It breaks when I want to use data3 and I believe it is because it is not able to add more rows to out.
...
1
vote
0
answers
39
views
How can I calculate Pearson Correlation in a memory-efficient way using Pandas?
I am building a simple user-based recommendation system using 10M MovieLens dataset. While calculating the Pearson Correlation, the enormous size of the data (69878 row, 10677 cols) overwhelms my ...
-2
votes
0
answers
50
views
Most efficient way to compare \ work with filtered Series / Dataframe rows
When I'create filtered Series or Dataframe object I get filtered indices too:
not_na_prices:pd.Dataframe = price[(price["price1"].notna()) & (price["price2"].notna())]
print(...