import numpy print "asdf" When I try to debug/run the above Python code in Visual Studio Code I get the following error (Using OSX) ImportError, cannot im
I am trying to vectorize the following code: for i in xrange(s.shape[0]): a[i] = np.argmax(np.random.multinomial(1,s[i,:])) s.shape = 400 x 100 [
Is there a better way to determine whether a variable in Pandas and/or NumPy is numeric or not ? I have a self defined dictionary with dtypes as keys and nume
I have a tensor with the following properties. I want to save the numpy = 1 but I don't know how to access this value. How do I do this? test_labels[1] <tf.
NOTE Added After: I finally got numpydoc working. It was also a python 2 problem. I ran 2to3 on it and now it seems to be working. OK, I've spent an entire d
For a current project I have to compute the inner product of a lot of vectors with the same matrix (which is quite sparse). The vectors are associated with a tw
I have written the following code to plot 6 pie charts in different subplots, but I get an error. This code works correctly if I use it to plot only 2 charts, b
I'm working on my master thesis right now and need to animate a high number of points moving. Those points will be representing predators and prey. The number o
Hi I have a list flat which is length 2800, it contains 100 results for each of 28 variables: Below is an example of 4 results for 2 variables [0, 0, 1, 1,
I need convert the data stored in a pandas.DataFrame into a byte string where each column can have a separate data type (integer or floating point). Here is a
I am trying to use OpenCV with Python in order to detect squares in a live video feed from a Raspberry Pi camera. However, the cv2.GaussianBlur and cv2.Canny fu
I am trying to use OpenCV with Python in order to detect squares in a live video feed from a Raspberry Pi camera. However, the cv2.GaussianBlur and cv2.Canny fu
This code generates error: IndexError: invalid index to scalar variable. at the line: results.append(RMSPE(np.expm1(y_train[testcv]), [y[1] for y in y_test])
How can I do the indexing of some arrays used as indices? I have the following six 2D arrays like this- array([[2, 0], [3, 0], [3, 1], [5, 0], [5, 1
I have two curves that have their maximum roughly at the same time, but I'd like to match them exactly. The first function, maxind, determines where the maximum
Since NumPy version 19.0, one must specify dtype=object when creating an array from "ragged" sequences. I'm faced with a large number of array calls from my own
I have an array of distances called dists. I want to select dists which are within a range. dists[(np.where(dists >= r)) and (np.where(dists <= r + dr))]
I have a numpy array of np.shape=(n,) I am attempting to iterate through each value of the array and subtract the 2nd value from the 1st, then see if the differ
I'd like to copy a numpy 2D array into a third dimension. For example, given the 2D numpy array: import numpy as np arr = np.array([[1, 2], [1, 2]]) # arr.shap
I want to scale a dataframe, which raises the error as in the title (or below). My data: df.head() timestamp open high low close volume 0 2020-06-2