Skip to content

Tag: numpy

Convert dataframe to a rec array (and objects to strings)

I have a pandas dataframe with a mix of datatypes (dtypes) that I wish to convert to a numpy structured array (or record array, basically the same thing in this case). For purely numeric dataframes, this is easy to do with the to_records() method. I also need the dtypes of pandas columns to be converted to st…

Finding day of the week for a datetime64

Apologies if this is an easy one but I can’t see anything in the numpy documentation. I have a datetime64 and I’d like to find out which day of the week it is. Unlike python datetime, datetime64 doesn’t seem to have a .weekday() function. However it does have a busday_offset() function, whic…

Is there a GUI to see contents of .npy file?

I am working with Python 2. I have saved a dict of arrays to a .npy file on my computer. If I open it as a text file, a just see a mess of ASCII characters, as one would expect since I am not just saving arrays. I can see its contents by np.load it in a Python console, but

What is the use of bincount() method from numpy?

What is its purpose? I tried reading the official site but wasn’t able to understand. Answer bincount returns the count of values in each bin from 0 to the largest value in the array i.e. e.g. Note: absent numbers (e.g. 5 above) return a count of 0 a ValueError is raised if the list contains negative nu…

loading EMNIST-letters dataset

I have been trying to find a way to load the EMNIST-letters dataset but without much success. I have found interesting stuff in the structure and can’t wrap my head around what is happening. Here is what I mean: I downloaded the .mat format in here I can load the data using it is a dictionnary with the …

Installing numpy with pip on windows 10 for python 3.7

I installed python 3.7 on my Windows 10 laptop since it has been officially released as of today (06/28/2018). Then i tried to install numpy package using pip The install proceeds but finally fails with the below error : Any ideas as to how to overcome this install Error? Thanks. Answer Installing NumPy on Wi…