Quantcast
Channel: Active questions tagged numpy - Stack Overflow
Browsing index pages (6523 articles)
↧

Converting list to numpy array

I have managed to load images in a folder using the command line sklearn: load_sample_images()I would now like to convert it to a numpy.ndarray format with float32 datatypeI was able to convert it to...

View Article


How can I tell if numpy is using threads?

I wan't to know if numpy is using threads over the available cores on my system. I know MATLAB does this under the hood. But is there any sure fire way I can find out if numpy is running threaded. My...

View Article


Image may be NSFW.
Clik here to view.

PIL image to numpy

I have a NumPy image (2 dimensional) where each pixel range is in thousands. I want to convert it to an RGB image (3-dimensional), with a range from 0 to 255. so I did the following:from PIL import...

View Article

How to sum elements in a 2d array and then find max/highest value? [duplicate]

This is my dataset:data_usage = np.array([ [1.2, 0.8, 1.5, 2.0, 1.1, 3.5, 2.8], # Student A [2.0, 1.9, 2.2, 1.8, 2.5, 4.0, 3.6], # Student B [0.5, 0.6, 0.4, 0.7, 0.5, 1.2, 1.0], # Student C [3.0, 2.8,...

View Article

loop of ufunc does not support argument 0 of type float which has no callable...

I am having trouble with an optimization that used to work with a previous version of python...I have a function fp = lambda c, x: (c[0])+ (c[1]*((1- np.exp(-x/c[4]))/(x/c[4])))+...

View Article


Matplotlib with JSON files

I am trying to combine two sources of code with no avail. I am using the default finance2.py matplotlib example (listed below) with json files (also listed below). the "finance.fetch_historical_yahoo"...

View Article

How can I get a count of occurrances in csv columns and save as a new csv...

I am new to python, I would really appreciate the assistance. I trie the entire day. I have a csv file containing 10 columns. I am only interested in 3 state, county and zipcode. I am trying, trying...

View Article

Which TensorFlow version is compatible with NumPy version==1.18?

I need to use the librosa and tensorflow packages for a Neural Network audio classification project.librosa has a dependency on the numba package, which requires numpy version==1.18.But, tensorflow...

View Article


numpy warnings in PyCharm

Today I have been through the wringer.I code these small projects for fun in Python and in my current project, I mainly toy around with numpy. I needed an array for strings and stumbled upon...

View Article


Converting a list of images using OpenCV to a NumPy array returns an error:...

I am trying to read 8 different .png images into a NumPy array on Python 3.5 OpenCV 2.import numpy as npimport cv2import osUsing the 'os' class methods, I am able to pick all the .png files from a...

View Article

How does density=True work in plt.hist and numpy.histogram?

I want to understand how the density=True works in np.histogram and plt.hist.Here I have printed the bin counts of my histogram. According to my understanding for calculating probability, I need to...

View Article

Moving average or running mean

Is there a SciPy function or NumPy function or module for Python that calculates the running mean of a 1D array given a specific window?

View Article

Image may be NSFW.
Clik here to view.

How to draw vertical histogram projection on x axis?

Here is the example of image histogram horizontal projection from Articlefor row in range(height): cv2.line(blankImage, (0,row), (int(horizontal_projection[row]*width/height),row), (255,255,255), 1)I...

View Article


How to install NumPy and Pandas with my current python setup?

I am just starting to learn Python in a big hurry (had a positive job interview, was told 'learn Python, NumPy, and Pandas and be ready to take a test on that stuff in 3 weeks'). After my first online...

View Article

Im new to coding i was following a multi object detection tut in python and...

I've been looking for answers but i just don't know know how to apply them to my use case yet.hope i can get some help :)import cv2 as cvimport numpy as nphaystack_img = cv.imread('pokemon_tempv2.png',...

View Article


Error while generating package metadata --> numpy

My Question: I am trying to run an acoustic program with Python. I have encountered an error in the file while executing "pip install arlpy". I am using the instructions from the following pdf and am...

View Article

How to compute a gradient column-wise in a pandas DataFrame using the index...

I'd like to compute the gradient of a DataFrame, for which I can gather that the best method is to use .apply(), e.g:df = pd.DataFrame([[1,2,3],[4,5,6],[7,8,9]])df =...

View Article


Image may be NSFW.
Clik here to view.

How can I obtain a white mask of a foreground object using OpenCV?

I'm trying to create a mask. I have a database of images similar to this BAYC image, which I use as the input/starting image.Here is the same result that I want, applied to a different image that I...

View Article

NumPy: function for simultaneous max() and min()

numpy.amax() will find the max value in an array, and numpy.amin() does the same for the min value. If I want to find both max and min, I have to call both functions, which requires passing over the...

View Article

Cannot read the second arm of the Analog Clock correctly by using opencv python

Picture Link since I cannot upload it> Thank you https://github.com/HassanAdamm that I can be able to continue the further code but still cannot display the correct second hand of the Analog Clock...

View Article
Browsing index pages (6523 articles)


Latest Images