Tag: io

61 votes
10 answers
962 views
Fitting empirical distribution to theoretical ones with Scipy (Python)?

INTRODUCTION: I have a list of more than 30,000 integer values ranging from 0 to 47, inclusive, e.g.[0,0,0,0,.

avatar
Renaldo
0 1 0 9
asked 07 September, 2021
43 votes
7 answers
2.6K views
How to do exponential and logarithmic curve fitting in Python? I found only polynomial fitting

I have a set of data and I want to compare which line describes it best (polynomials of different orders, expo

avatar
Luis
0 1 0 9
asked 07 September, 2021
62 votes
15 answers
1.6K views
Installing SciPy with pip

It is possible to install NumPy with pip using pip install numpy. Is there a similar possibility with SciPy?

avatar
Jeff
0 1 0 9
asked 07 September, 2021
59 votes
12 answers
2.3K views
Read .mat files in Python

Is it possible to read binary MATLAB .mat files in Python? I've seen that SciPy has alleged support for

avatar
Majorie
0 1 0 9
asked 07 September, 2021
52 votes
2 answers
2.2K views
Why does this Jython loop fail after a single run?

I've got the following code: public static String getVersion() { PythonInterpreter interpreter = ne

avatar
Clarice
0 1 0 9
asked 07 September, 2021
54 votes
3 answers
2.7K views
How to catch an exception in python and get a reference to the exception, WITHOUT knowing the type?

I'm wondering how I can catch any raised object (i.e. a type that does not extend Exception), and still g

avatar
Vi
0 1 0 9
asked 07 September, 2021
56 votes
6 answers
2.5K views
Migrating from CPython to Jython

I'm considering moving my code (around 30K LOC) from CPython to Jython, so that I could have better integ

avatar
Benton
0 1 0 9
asked 07 September, 2021
57 votes
10 answers
599 views
How do I convert a numpy array to (and display) an image?

I have created an array thusly: import numpy as np data = np.zeros( (512,512,3), dtype=np.uint8) data[256,256

avatar
Tana
0 1 0 9
asked 07 September, 2021
53 votes
5 answers
2.6K views
What is the difference between ndarray and array in numpy?

What is the difference between ndarray and array in Numpy? And where can I find the implementations in the num

avatar
Majorie
0 1 0 9
asked 07 September, 2021
58 votes
6 answers
1.9K views
Concatenating two one-dimensional NumPy arrays

I have two simple one-dimensional arrays in NumPy. I should be able to concatenate them using numpy.concatenat

avatar
Hilario
0 1 0 9
asked 07 September, 2021
47 votes
17 answers
2.5K views
How do I check which version of NumPy I'm using?

How can I check which version of NumPy I'm using? (FYI this question has been edited because both the qu

avatar
Kristopher
0 1 0 9
asked 07 September, 2021
50 votes
7 answers
1.3K views
Comparing two NumPy arrays for equality, element-wise

What is the simplest way to compare two NumPy arrays for equality (where equality is defined as: A = B iff for

avatar
Hildegard
0 1 0 9
asked 07 September, 2021
54 votes
3 answers
2.6K views
What is the difference between flatten and ravel functions in numpy?

import numpy as np y = np.array(((1,2,3),(4,5,6),(7,8,9))) OUTPUT: print(y.flatten()) [1 2 3 4 5 6

avatar
Arline
0 1 0 9
asked 07 September, 2021
54 votes
7 answers
1.3K views
Difference between numpy.array shape (R, 1) and (R,)

In numpy, some of the operations return in shape (R, 1) but some return (R,). This will make matrix multiplica

avatar
Solomon
0 1 0 9
asked 07 September, 2021
69 votes
7 answers
442 views
What is the purpose of meshgrid in Python / NumPy?

Can someone explain to me what is the purpose of meshgrid function in Numpy? I know it creates some kind of gr

avatar
Yolando
0 1 0 9
asked 07 September, 2021
66 votes
3 answers
414 views
Simple Digit Recognition OCR in OpenCV-Python

I am trying to implement a "Digit Recognition OCR" in OpenCV-Python (cv2). It is just for learning purposes. I

avatar
Serina
0 1 0 9
asked 07 September, 2021
65 votes
8 answers
415 views
Numpy array dimensions

I'm currently trying to learn Numpy and Python. Given the following array: import numpy as np a = np.arr

avatar
Fabian
0 1 0 9
asked 07 September, 2021
55 votes
17 answers
1.5K views
How to find all occurrences of an element in a list

index() will give the first occurrence of an item in a list. Is there a neat trick which returns all indices i

avatar
Shanita
0 1 0 9
asked 07 September, 2021
47 votes
30 answers
797 views
How to count the occurrence of certain item in an ndarray?

In Python, I have an ndarray y that is printed as array([0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1]) I'm trying

avatar
Lynette
0 1 0 9
asked 07 September, 2021
57 votes
21 answers
1.9K views
How to print the full NumPy array, without truncation?

When I print a numpy array, I get a truncated representation, but I want the full array. Is there any way to

avatar
Cortez
0 1 0 9
asked 07 September, 2021