[Numpy-discussion] fromiter cannot create array of object - was: Creating an ndarray from an iterable, over sequences

2014-01-21 Thread Dr. Leo
Hi, thanks. Both recarray and itertools.chain work just fine in the example case. However, the real purpose of this is to read strings from a large xml file into a pandas DataFrame. But fromiter cannot create arrays of dtype 'object'. Fixed length strings may be worth trying. But as the xml schem

Re: [Numpy-discussion] using loadtxt to load a text file in to a numpy array

2014-01-21 Thread Andrew Collette
Hi Chris, > it looks from here: > http://www.hdfgroup.org/HDF5/doc/ADGuide/WhatsNew180.html > > that HDF uses utf-8 for unicode strings -- so you _could_ roundtrip with a > lot of calls to encode/decode -- which could be pretty slow, compared to > other ways to dump numpy arrays into HDF-5 -- that

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Chris Barker - NOAA Federal
On Jan 21, 2014, at 4:58 PM, David Goldsmith wrote: > > OK, well that's definitely beyond my level of expertise. Well, it's in github--now's as good a time as any to learn github collaboration... -Fork the numpy source. -Create a new file in: numpy/doc/neps Point folks to it here so they can

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread David Goldsmith
Date: Tue, 21 Jan 2014 19:20:12 + > From: Robert Kern > Subject: Re: [Numpy-discussion] A one-byte string dtype? > > The wiki is frozen. Please do not add anything to it. It plays no role in > our current development workflow. Drafting a NEP or two and iterating on > them would be the next

Re: [Numpy-discussion] using loadtxt to load a text file in to a numpy array

2014-01-21 Thread Chris Barker
On Tue, Jan 21, 2014 at 3:22 PM, Andrew Collette wrote: > Just stumbled on this discussion (I'm the lead author of h5py). > > We would be overjoyed if there were a 1-byte text type available in > NumPy. cool -- it looks like someone is going to get a draft PEP going -- so stay tuned, and add you

Re: [Numpy-discussion] using loadtxt to load a text file in to a numpy array

2014-01-21 Thread Andrew Collette
Hi Chris, Just stumbled on this discussion (I'm the lead author of h5py). We would be overjoyed if there were a 1-byte text type available in NumPy. String handling is the source of major pain right now in the HDF5 world. All HDF5 strings are text (opaque types are used for binary data), but we

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Robert Kern
On Tue, Jan 21, 2014 at 6:34 PM, David Goldsmith wrote: >> I can certainly get one started (but I don't think I can faithfully >> summarize all this thread's current content, so I apologize in advance for >> leaving that undone). >> >> DG > > OK, I'm "lost" already: is there general agreement tha

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread David Goldsmith
On Tue, Jan 21, 2014 at 10:00 AM, wrote: > Date: Tue, 21 Jan 2014 09:53:25 -0800 > From: David Goldsmith > Subject: Re: [Numpy-discussion] A one-byte string dtype? > To: numpy-discussion@scipy.org > Message-ID: > 7altpxmrz4miujy2xebyi_fy5...@mail.gmail.com> > Content-Type: text/plain; ch

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Charles R Harris
On Tue, Jan 21, 2014 at 11:00 AM, Chris Barker wrote: > A lot of good discussion here -- to much to comment individually, but it > seems we can boil it down to a couple somewhat distinct proposals: > > 1) a one-byte-per-char dtype: > > This would provide compact, high efficiency storage for commo

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Chris Barker
A lot of good discussion here -- to much to comment individually, but it seems we can boil it down to a couple somewhat distinct proposals: 1) a one-byte-per-char dtype: This would provide compact, high efficiency storage for common text for scientific computing. It is analogous to a lower-preci

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread David Goldsmith
> Date: Tue, 21 Jan 2014 17:35:26 + > From: Nathaniel Smith > Subject: Re: [Numpy-discussion] A one-byte string dtype? > To: Discussion of Numerical Python > Message-ID: > ke3xlga2+gz+qd4f0xs2uboeysg...@mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > On 21 Jan 2014 17

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Chris Barker
On Tue, Jan 21, 2014 at 9:28 AM, David Goldsmith wrote: > > Am I the only one who feels that this (very important--I'm being sincere, > not sarcastic) thread has matured and specialized enough to warrant it's > own home on the Wiki? > Or maybe a NEP? https://github.com/numpy/numpy/tree/master/d

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Nathaniel Smith
On 21 Jan 2014 17:28, "David Goldsmith" wrote: > > > Am I the only one who feels that this (very important--I'm being sincere, not sarcastic) thread has matured and specialized enough to warrant it's own home on the Wiki? Sounds plausible, perhaps you could write up such a page? -n _

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread David Goldsmith
Am I the only one who feels that this (very important--I'm being sincere, not sarcastic) thread has matured and specialized enough to warrant it's own home on the Wiki? DG ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org

Re: [Numpy-discussion] (no subject)

2014-01-21 Thread Charles R Harris
On Tue, Jan 21, 2014 at 9:46 AM, Charles R Harris wrote: > > > > On Tue, Jan 21, 2014 at 9:26 AM, jennifer stone > wrote: > >> >> >What are your interests and experience? If you use numpy, are there >>> things >>> >you would like to fix, or enhancements you would like to see? >>> >>> Chuck >>> >

Re: [Numpy-discussion] (no subject)

2014-01-21 Thread Stéfan van der Walt
On Tue, 21 Jan 2014 21:56:17 +0530, jennifer stone wrote: > I am an undergraduate student with CS as major and have interest in Math > and Physics. This has led me to use NumPy and SciPy to work on innumerable > cases involving special polynomial functions and polynomials like Legendre > polynomia

Re: [Numpy-discussion] (no subject)

2014-01-21 Thread Charles R Harris
On Tue, Jan 21, 2014 at 9:26 AM, jennifer stone wrote: > > >What are your interests and experience? If you use numpy, are there things >> >you would like to fix, or enhancements you would like to see? >> >> Chuck >> >> > I am an undergraduate student with CS as major and have interest in Math > a

Re: [Numpy-discussion] (no subject)

2014-01-21 Thread jennifer stone
> >What are your interests and experience? If you use numpy, are there things > >you would like to fix, or enhancements you would like to see? > > Chuck > > I am an undergraduate student with CS as major and have interest in Math and Physics. This has led me to use NumPy and SciPy to work on innum

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Sebastian Berg
On Tue, 2014-01-21 at 07:48 -0700, Charles R Harris wrote: > > > > On Tue, Jan 21, 2014 at 7:37 AM, Aldcroft, Thomas > wrote: > > > > On Tue, Jan 21, 2014 at 8:55 AM, Charles R Harris > wrote: > > > >

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Charles R Harris
On Tue, Jan 21, 2014 at 7:37 AM, Aldcroft, Thomas < aldcr...@head.cfa.harvard.edu> wrote: > > > > On Tue, Jan 21, 2014 at 8:55 AM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > >> >> >> >> On Tue, Jan 21, 2014 at 5:54 AM, Aldcroft, Thomas < >> aldcr...@head.cfa.harvard.edu> wrote: >> >>

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Oscar Benjamin
On Tue, Jan 21, 2014 at 06:55:29AM -0700, Charles R Harris wrote: > > Well, that's open for discussion. The problem is to have something that is > both compact (latin-1) and interoperates transparently with python 3 > strings (utf-8). A latin-1 type would be easier to implement and would > probably

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Aldcroft, Thomas
On Tue, Jan 21, 2014 at 8:55 AM, Charles R Harris wrote: > > > > On Tue, Jan 21, 2014 at 5:54 AM, Aldcroft, Thomas < > aldcr...@head.cfa.harvard.edu> wrote: > >> >> >> >> On Mon, Jan 20, 2014 at 6:12 PM, Charles R Harris < >> charlesr.har...@gmail.com> wrote: >> >>> >>> >>> >>> On Mon, Jan 20, 20

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Charles R Harris
On Tue, Jan 21, 2014 at 5:54 AM, Aldcroft, Thomas < aldcr...@head.cfa.harvard.edu> wrote: > > > > On Mon, Jan 20, 2014 at 6:12 PM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > >> >> >> >> On Mon, Jan 20, 2014 at 3:58 PM, Charles R Harris < >> charlesr.har...@gmail.com> wrote: >> >>> >>

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Aldcroft, Thomas
On Mon, Jan 20, 2014 at 6:12 PM, Charles R Harris wrote: > > > > On Mon, Jan 20, 2014 at 3:58 PM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > >> >> >> >> On Mon, Jan 20, 2014 at 3:35 PM, Nathaniel Smith wrote: >> >>> On Mon, Jan 20, 2014 at 10:28 PM, Charles R Harris >>> wrote: >>>

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Oscar Benjamin
On Tue, Jan 21, 2014 at 11:41:30AM +, Nathaniel Smith wrote: > On 21 Jan 2014 11:13, "Oscar Benjamin" wrote: > > If the Numpy array would manage the buffers itself then that per string > memory > > overhead would be eliminated in exchange for an 8 byte pointer and at > least 1 > > byte to repr

Re: [Numpy-discussion] Creating an ndarray from an iterable over sequences

2014-01-21 Thread Oscar Benjamin
On Tue, Jan 21, 2014 at 07:34:19AM +0100, Dr. Leo wrote: > Hi, > > I would like to write something like: > > In [25]: iterable=((i, i**2) for i in range(10)) > > In [26]: a=np.fromiter(iterable, int32) > --- > ValueError

Re: [Numpy-discussion] Creating an ndarray from an iterable over sequences

2014-01-21 Thread eat
Hi, On Tue, Jan 21, 2014 at 8:34 AM, Dr. Leo wrote: > Hi, > > I would like to write something like: > > In [25]: iterable=((i, i**2) for i in range(10)) > > In [26]: a=np.fromiter(iterable, int32) > --- > ValueError

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Nathaniel Smith
On 21 Jan 2014 11:13, "Oscar Benjamin" wrote: > If the Numpy array would manage the buffers itself then that per string memory > overhead would be eliminated in exchange for an 8 byte pointer and at least 1 > byte to represent the length of the string (assuming you can somehow use > Pascal strings

Re: [Numpy-discussion] A one-byte string dtype?

2014-01-21 Thread Oscar Benjamin
On Mon, Jan 20, 2014 at 04:12:20PM -0700, Charles R Harris wrote: > On Mon, Jan 20, 2014 at 3:58 PM, Charles R Harris wrote: > > On Mon, Jan 20, 2014 at 3:35 PM, Nathaniel Smith wrote: > >> On Mon, Jan 20, 2014 at 10:28 PM, Charles R Harris > >> wrote: > >> > > >> > I didn't say we should chang