Tag: numpy

66 votes
3 answers
625 views
Why does numpy std() give a different result to matlab std()?

I try to convert matlab code to numpy and figured out that numpy has a different result with the std function.

avatar
Patsy
0 1 0 9
asked 07 September, 2021
54 votes
7 answers
730 views
What is the equivalent of MATLAB's repmat in NumPy

I would like to execute the equivalent of the following MATLAB code using NumPy: repmat([1; 1], [1 1 1]). How

avatar
Hallie
0 1 0 9
asked 07 September, 2021
47 votes
4 answers
2.3K views
shuffle vs permute numpy

What is the difference between numpy.random.shuffle(x) and numpy.random.permutation(x)? I have read the doc p

avatar
Scot
0 1 0 9
asked 07 September, 2021
63 votes
9 answers
519 views
ImportError: cannot import name NUMPY_MKL

I am trying to run the following simple code import scipy scipy.test() But I am getting the following erro

avatar
Emilia
0 1 0 9
asked 07 September, 2021
55 votes
2 answers
2.6K views
Two-sample Kolmogorov-Smirnov Test in Python Scipy

I can't figure out how to do a Two-sample KS test in Scipy. After reading the documentation scipy kstest

avatar
Chelsea
0 1 0 9
asked 07 September, 2021
58 votes
4 answers
2.7K views
How to transform numpy.matrix or array to scipy sparse matrix

For SciPy sparse matrix, one can use todense() or toarray() to transform to NumPy matrix or array. What are th

avatar
Patsy
0 1 0 9
asked 07 September, 2021
69 votes
12 answers
2.1K views
scipy: savefig without frames, axes, only content

In numpy/scipy I have an image stored in an array. I can display it, I want to save it using savefig without a

avatar
Robyn
0 1 0 9
asked 07 September, 2021
52 votes
7 answers
651 views
Plotting a fast Fourier transform in Python

I have access to NumPy and SciPy and want to create a simple FFT of a data set. I have two lists, one that is

avatar
Deedee
0 1 0 9
asked 07 September, 2021
65 votes
11 answers
1.5K views
Principal component analysis in Python

I'd like to use principal component analysis (PCA) for dimensionality reduction. Does numpy or scipy alr

avatar
Wei
0 1 0 9
asked 07 September, 2021
48 votes
7 answers
1K views
Histogram Matplotlib

So I have a little problem. I have a data set in scipy that is already in the histogram format, so I have the

avatar
Renaldo
0 1 0 9
asked 07 September, 2021
56 votes
8 answers
784 views
How to calculate cumulative normal distribution?

I am looking for a function in Numpy or Scipy (or any rigorous Python library) that will give me the cumulativ

avatar
Wei
0 1 0 9
asked 07 September, 2021
57 votes
6 answers
1.5K views
binning data in python with scipy/numpy

is there a more efficient way to take an average of an array in prespecified bins? for example, i have an arra

avatar
Bryan
0 1 0 9
asked 07 September, 2021
61 votes
13 answers
532 views
ImportError in importing from sklearn: cannot import name check_build

I am getting the following error while trying to import from sklearn: >>> from sklearn import svm T

avatar
Alphonso
0 1 0 9
asked 07 September, 2021
49 votes
5 answers
1.3K views
How to check BLAS/LAPACK linkage in NumPy and SciPy?

I am builing my numpy/scipy environment based on blas and lapack more or less based on this walk through. Wh

avatar
Freida
0 1 0 9
asked 07 September, 2021
56 votes
9 answers
695 views
Numpy Resize/Rescale Image

I would like to take an image and change the scale of the image, while it is a numpy array. For example I hav

avatar
Tuan
0 1 0 9
asked 07 September, 2021
57 votes
6 answers
2.3K views
How to create a density plot in matplotlib?

In R I can create the desired output by doing: data = c(rep(1.5, 7), rep(2.5, 2), rep(3.5, 8), rep(

avatar
Kristopher
0 1 0 9
asked 07 September, 2021
59 votes
3 answers
2.5K views
Confusion between numpy, scipy, matplotlib and pylab

Numpy, scipy, matplotlib, and pylab are common terms among they who use python for scientific computation. I

avatar
Arline
0 1 0 9
asked 07 September, 2021
56 votes
14 answers
1.5K views
Multiple linear regression in Python

I can't seem to find any python libraries that do multiple regression. The only things I find only do sim

avatar
Jeff
0 1 0 9
asked 07 September, 2021
57 votes
6 answers
1.4K views
Numpy: Divide each row by a vector element

Suppose I have a numpy array: data = np.array([[1,1,1],[2,2,2],[3,3,3]]) and I have a corresponding "vector

avatar
Charis
0 1 0 9
asked 07 September, 2021
54 votes
2 answers
1.4K views
Should I use scipy.pi, numpy.pi, or math.pi?

In a project using SciPy and NumPy, should I use scipy.pi, numpy.pi, or math.pi?

avatar
Clarice
0 1 0 9
asked 07 September, 2021