[Numpy-discussion] Parsing a file with dates to datetim64

2016-09-26 Thread Florian Lindner
Hey, I have a file: ;Eintrittsdatum;;; ;04.03.16;;10,00 €;genehmigt ;04.03.16;;10,00 €;genehmigt which I try to parse using def dateToNumpyDate(s): s = s.decode("utf-8") ret = datetime.datetime.strptime(s, "%d.%m.%y").isoformat() return ret def

Re: [Numpy-discussion] Reading in a mesh file

2016-09-01 Thread Florian Lindner
obert Kern: > On Wed, Aug 31, 2016 at 4:00 PM, Florian Lindner <mailingli...@xgm.de > <mailto:mailingli...@xgm.de>> wrote: >> >> Hello, >> >> I have mesh (more exactly: just a bunch of nodes) description with values >> associated to the nodes in a fi

[Numpy-discussion] Reading in a mesh file

2016-08-31 Thread Florian Lindner
Hello, I have mesh (more exactly: just a bunch of nodes) description with values associated to the nodes in a file, e.g. for a 3x3 mesh: 0 0 10 0 0.3 11 0 0.6 12 0.3 0 20 0.3 0.3 21 0.3 0.6 22 0.6 0 30 0.6 0.3 31 0.6 0.6 32 What is best way to read it in and get data structures

Re: [Numpy-discussion] Remove a random sample from array

2016-05-16 Thread Florian Lindner
ble. Best, Florian > On May 16, 2016 9:08 AM, "Florian Lindner" <mailingli...@xgm.de> wrote: > > Hello, > > > > I have an array of shape (n, 2) from which I want to extract a random > > sample > > of 20% of rows. The choosen samples should be r

[Numpy-discussion] Remove a random sample from array

2016-05-16 Thread Florian Lindner
Hello, I have an array of shape (n, 2) from which I want to extract a random sample of 20% of rows. The choosen samples should be removed the original array and moved to a new array of the same shape (n, 2). What is the most clever way to do with numpy? Thanks, Florian

[Numpy-discussion] NPY_DOUBLE not declared

2015-08-17 Thread Florian Lindner
Hello, I try to converse a piece of C code to the new NumPy API to get rid of the deprecation warning. #warning Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION As a first step I replaced arrayobject.h by numpy/npy_math.h: #include Python.h

[Numpy-discussion] MPI: Sendrecv blocks

2015-05-27 Thread Florian Lindner
Hello, I have this piece of code: comm = MPI.COMM_WORLD temp = np.zeros(blockSize*blockSize) PrintNB(Communicate A to, get_left_rank()) comm.Sendrecv(sendbuf=np.ascontiguousarray(lA), dest=get_left_rank(), recvbuf=temp) lA = np.reshape(temp, (blockSize, blockSize)) PrintNB(Finished sending)

[Numpy-discussion] Joining lists to an array

2013-12-02 Thread Florian Lindner
Hello, I have this piece of example code import random, numpy as np y = [] doc_all = [] # da = np.zeros(2) for i in range(4): docs = range(random.randint(1, 10)) y += [i]*len(docs) doc_all += docs # np.append(da, np.column_stack((docs, y)), axis=0) data =