Re: [Numpy-discussion] loadtxt and usecols

2015-11-13 Thread Irvin Probst
On 11/11/2015 18:38, Sebastian Berg wrote: Sounds fine to me, and considering the squeeze logic (which I think is unfortunate, but it is not something you can easily change), I would be for simply adding logic to accept a single integral argument and otherwise not change anything. [...] As

Re: [Numpy-discussion] loadtxt and usecols

2015-11-11 Thread Sebastian Berg
On Di, 2015-11-10 at 17:39 +0100, Irvin Probst wrote: > On 10/11/2015 16:52, Daπid wrote: > > 42, is exactly the same as (42,) If you want a tuple of > > tuples, you have to do ((42,),), but then it raises: TypeError: list > > indices must be integers, not tuple. > > My bad, I wrote

Re: [Numpy-discussion] loadtxt and usecols

2015-11-10 Thread Benjamin Root
Just pointing out np.loadtxt(..., ndmin=2) will always return a 2D array. Notice that without that option, the result is effectively squeezed. So if you don't specify that option, and you load up a CSV file with only one row, you will get a very differently shaped array than if you load up a CSV

Re: [Numpy-discussion] loadtxt and usecols

2015-11-10 Thread Sebastian Berg
On Di, 2015-11-10 at 10:24 -0500, Benjamin Root wrote: > Just pointing out np.loadtxt(..., ndmin=2) will always return a 2D > array. Notice that without that option, the result is effectively > squeezed. So if you don't specify that option, and you load up a CSV > file with only one row, you will

Re: [Numpy-discussion] loadtxt and usecols

2015-11-10 Thread Irvin Probst
On 10/11/2015 14:17, Sebastian Berg wrote: Actually, it is the "sequence special case" type ;). (matlab does not have this, since matlab always returns 2-D I realized). As I said, if usecols is like indexing, the result should mimic: arr = np.loadtxt(f) arr = arr[usecols] in which case a 1-D

Re: [Numpy-discussion] loadtxt and usecols

2015-11-10 Thread Daπid
On 10 November 2015 at 16:07, Irvin Probst wrote: > I know this new behavior might break a lot of existing code as > usecol=(42,) used to return a 1-D array, but usecol=42, also > returns a 1-D array so the current behavior is not consistent imho.

Re: [Numpy-discussion] loadtxt and usecols

2015-11-10 Thread Irvin Probst
On 10/11/2015 16:52, Daπid wrote: 42, is exactly the same as (42,) If you want a tuple of tuples, you have to do ((42,),), but then it raises: TypeError: list indices must be integers, not tuple. My bad, I wrote that too fast, please forget this. I think loadtxt should be a tool to

Re: [Numpy-discussion] loadtxt and usecols

2015-11-10 Thread Sebastian Berg
On Mo, 2015-11-09 at 20:36 +0100, Ralf Gommers wrote: > > > On Mon, Nov 9, 2015 at 7:42 PM, Benjamin Root > wrote: > My personal rule for flexible inputs like that is that it > should be encouraged so long as it does not introduce > ambiguity.

Re: [Numpy-discussion] loadtxt and usecols

2015-11-10 Thread Irvin Probst
On 10/11/2015 09:19, Sebastian Berg wrote: since a scalar row (so just one row) is read and not a 2D array. I tend to say it should be an array-like argument and not a generalized sequence argument, just wanted to note that, since I am not sure what matlab does. Hi, By default Matlab reads

Re: [Numpy-discussion] loadtxt and usecols

2015-11-10 Thread Sebastian Berg
On Di, 2015-11-10 at 10:24 +0100, Irvin Probst wrote: > On 10/11/2015 09:19, Sebastian Berg wrote: > > since a scalar row (so just one row) is read and not a 2D array. I tend > > to say it should be an array-like argument and not a generalized > > sequence argument, just wanted to note that, since

Re: [Numpy-discussion] loadtxt and usecols

2015-11-09 Thread Benjamin Root
My personal rule for flexible inputs like that is that it should be encouraged so long as it does not introduce ambiguity. Furthermore, Allowing a scalar as an input doesn't add a congitive disconnect on the user on how to specify multiple columns. Therefore, I'd give this a +1. On Mon, Nov 9,

Re: [Numpy-discussion] loadtxt and usecols

2015-11-09 Thread Ralf Gommers
On Mon, Nov 9, 2015 at 7:42 PM, Benjamin Root wrote: > My personal rule for flexible inputs like that is that it should be > encouraged so long as it does not introduce ambiguity. Furthermore, > Allowing a scalar as an input doesn't add a congitive disconnect on the > user

[Numpy-discussion] loadtxt and usecols

2015-11-09 Thread Irvin Probst
Hi, I've recently seen many students, coming from Matlab, struggling against the usecols argument of loadtxt. Most of them tried something like: loadtxt("foo.bar", usecols=2) or the ones with better documentation reading skills tried loadtxt("foo.bar", usecols=(2)) but none of them understood

Re: [Numpy-discussion] loadtxt ndmin option

2011-06-19 Thread Derek Homeier
On 31 May 2011, at 21:28, Pierre GM wrote: On May 31, 2011, at 6:37 PM, Derek Homeier wrote: On 31 May 2011, at 18:25, Pierre GM wrote: On May 31, 2011, at 5:52 PM, Derek Homeier wrote: I think stuff like multiple delimiters should have been dealt with before, as the right place to insert

Re: [Numpy-discussion] loadtxt ndmin option

2011-06-03 Thread cgraves
Derek Homeier wrote: Hi Chris, On 31 May 2011, at 13:56, cgraves wrote: I've downloaded the latest numpy (1.6.0) and loadtxt has the ndmin option, however neither genfromtxt nor recfromtxt, which use loadtxt, have it. Should they have inherited the option? Who can make it happen?

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-31 Thread cgraves
Ralf Gommers-2 wrote: On Fri, May 6, 2011 at 12:57 PM, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: On 6 May 2011, at 07:53, Ralf Gommers wrote: Looks okay, and I agree that it's better to fix it now. The timing is a bit unfortunate though, just after RC2. I'll

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-31 Thread Derek Homeier
Hi Chris, On 31 May 2011, at 13:56, cgraves wrote: I've downloaded the latest numpy (1.6.0) and loadtxt has the ndmin option, however neither genfromtxt nor recfromtxt, which use loadtxt, have it. Should they have inherited the option? Who can make it happen? you are mistaken, genfromtxt

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-31 Thread Pierre GM
On May 31, 2011, at 4:53 PM, Derek Homeier wrote: Hi Chris, On 31 May 2011, at 13:56, cgraves wrote: I've downloaded the latest numpy (1.6.0) and loadtxt has the ndmin option, however neither genfromtxt nor recfromtxt, which use loadtxt, have it. Should they have inherited the

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-31 Thread Bruce Southey
On 05/31/2011 10:18 AM, Pierre GM wrote: On May 31, 2011, at 4:53 PM, Derek Homeier wrote: Hi Chris, On 31 May 2011, at 13:56, cgraves wrote: I've downloaded the latest numpy (1.6.0) and loadtxt has the ndmin option, however neither genfromtxt nor recfromtxt, which use loadtxt, have it.

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-31 Thread Benjamin Root
On Tue, May 31, 2011 at 10:33 AM, Bruce Southey bsout...@gmail.com wrote: On 05/31/2011 10:18 AM, Pierre GM wrote: On May 31, 2011, at 4:53 PM, Derek Homeier wrote: Hi Chris, On 31 May 2011, at 13:56, cgraves wrote: I've downloaded the latest numpy (1.6.0) and loadtxt has the ndmin

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-31 Thread Derek Homeier
On 31 May 2011, at 17:33, Bruce Southey wrote: It certainly would make sense to provide the same functionality for genfromtxt (which should then be inherited by [nd,ma,rec]fromtxt), so I'd go ahead and file a feature (enhancement) request. I can't promise I can take care of it myself,

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-31 Thread Derek Homeier
On 31 May 2011, at 17:45, Benjamin Root wrote: At this point, I wonder if it might be smarter to create a .atleast_Nd() function and use that everywhere it is needed. Having similar logic tailored for each loading function might be a little dangerous if bug fixes are made to one, but

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-31 Thread Pierre GM
On May 31, 2011, at 5:52 PM, Derek Homeier wrote: I think stuff like multiple delimiters should have been dealt with before, as the right place to insert the ndmin code (which includes the decision to squeeze or not to squeeze as well as to add additional dimensions, if required)

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-31 Thread Derek Homeier
On 31 May 2011, at 18:25, Pierre GM wrote: On May 31, 2011, at 5:52 PM, Derek Homeier wrote: I think stuff like multiple delimiters should have been dealt with before, as the right place to insert the ndmin code (which includes the decision to squeeze or not to squeeze as well as to add

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-31 Thread Pierre GM
On May 31, 2011, at 6:37 PM, Derek Homeier wrote: On 31 May 2011, at 18:25, Pierre GM wrote: On May 31, 2011, at 5:52 PM, Derek Homeier wrote: I think stuff like multiple delimiters should have been dealt with before, as the right place to insert the ndmin code (which includes the

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-07 Thread Ralf Gommers
On Fri, May 6, 2011 at 12:57 PM, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: On 6 May 2011, at 07:53, Ralf Gommers wrote: Looks okay, and I agree that it's better to fix it now. The timing is a bit unfortunate though, just after RC2. I'll have closer look tomorrow and

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-06 Thread Derek Homeier
On 6 May 2011, at 07:53, Ralf Gommers wrote: Looks okay, and I agree that it's better to fix it now. The timing is a bit unfortunate though, just after RC2. I'll have closer look tomorrow and if it can go in, probably tag RC3. If in the meantime a few more people could test this, that

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-05 Thread Benjamin Root
On Wed, May 4, 2011 at 11:08 PM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On 4. mai 2011, at 20.33, Benjamin Root wrote: On Wed, May 4, 2011 at 7:54 PM, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: On 05.05.2011, at 2:40AM, Paul Anton Letnes wrote: But:

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-05 Thread Benjamin Root
On Thu, May 5, 2011 at 10:49 AM, Benjamin Root ben.r...@ou.edu wrote: On Wed, May 4, 2011 at 11:08 PM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On 4. mai 2011, at 20.33, Benjamin Root wrote: On Wed, May 4, 2011 at 7:54 PM, Derek Homeier

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-05 Thread Paul Anton Letnes
On 5. mai 2011, at 08.49, Benjamin Root wrote: On Wed, May 4, 2011 at 11:08 PM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On 4. mai 2011, at 20.33, Benjamin Root wrote: On Wed, May 4, 2011 at 7:54 PM, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: On

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-05 Thread Benjamin Root
On Thu, May 5, 2011 at 1:08 PM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On 5. mai 2011, at 08.49, Benjamin Root wrote: On Wed, May 4, 2011 at 11:08 PM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On 4. mai 2011, at 20.33, Benjamin Root wrote: On Wed, May

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-05 Thread Ralf Gommers
On Thu, May 5, 2011 at 9:18 PM, Benjamin Root ben.r...@ou.edu wrote: On Thu, May 5, 2011 at 1:08 PM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On 5. mai 2011, at 08.49, Benjamin Root wrote: On Wed, May 4, 2011 at 11:08 PM, Paul Anton Letnes paul.anton.let...@gmail.com

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-05 Thread Benjamin Root
On Thu, May 5, 2011 at 2:33 PM, Ralf Gommers ralf.gomm...@googlemail.comwrote: On Thu, May 5, 2011 at 9:18 PM, Benjamin Root ben.r...@ou.edu wrote: On Thu, May 5, 2011 at 1:08 PM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On 5. mai 2011, at 08.49, Benjamin Root wrote:

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-05 Thread Ralf Gommers
On Thu, May 5, 2011 at 9:46 PM, Benjamin Root ben.r...@ou.edu wrote: On Thu, May 5, 2011 at 2:33 PM, Ralf Gommers ralf.gomm...@googlemail.comwrote: On Thu, May 5, 2011 at 9:18 PM, Benjamin Root ben.r...@ou.edu wrote: On Thu, May 5, 2011 at 1:08 PM, Paul Anton Letnes

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-05 Thread Derek Homeier
On 5 May 2011, at 22:53, Derek Homeier wrote: However, the problem that ndmin is supposed to address is not fixed by the current implementation for the rc. Essentially, a single- row, multi-column file with ndmin=2 comes out as a Nx1 array which is the same result for a multi-row,

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-05 Thread Ralf Gommers
On Fri, May 6, 2011 at 12:12 AM, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: On 5 May 2011, at 22:53, Derek Homeier wrote: However, the problem that ndmin is supposed to address is not fixed by the current implementation for the rc. Essentially, a single- row,

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-04 Thread Derek Homeier
Hi Paul, I've got back to your suggestion re. the ndmin flag for loadtxt from a few weeks ago... On 27.03.2011, at 12:09PM, Paul Anton Letnes wrote: 1562: I attach a possible patch. This could also be the default behavior to my mind, since the function caller can simply call

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-04 Thread Paul Anton Letnes
On 4. mai 2011, at 17.34, Derek Homeier wrote: Hi Paul, I've got back to your suggestion re. the ndmin flag for loadtxt from a few weeks ago... On 27.03.2011, at 12:09PM, Paul Anton Letnes wrote: 1562: I attach a possible patch. This could also be the default behavior to my mind,

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-04 Thread Derek Homeier
On 05.05.2011, at 2:40AM, Paul Anton Letnes wrote: But: Isn't the numpy.atleast_2d and numpy.atleast_1d functions written for this? Shouldn't we reuse them? Perhaps it's overkill, and perhaps it will reintroduce the 'transposed' problem? Yes, good point, one could replace the X.shape =

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-04 Thread Benjamin Root
On Wed, May 4, 2011 at 7:54 PM, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: On 05.05.2011, at 2:40AM, Paul Anton Letnes wrote: But: Isn't the numpy.atleast_2d and numpy.atleast_1d functions written for this? Shouldn't we reuse them? Perhaps it's overkill, and perhaps it will

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-04 Thread Paul Anton Letnes
On 4. mai 2011, at 20.33, Benjamin Root wrote: On Wed, May 4, 2011 at 7:54 PM, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: On 05.05.2011, at 2:40AM, Paul Anton Letnes wrote: But: Isn't the numpy.atleast_2d and numpy.atleast_1d functions written for this? Shouldn't we

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-04-04 Thread Bruce Southey
On 03/31/2011 12:02 PM, Derek Homeier wrote: On 31 Mar 2011, at 17:03, Bruce Southey wrote: This is an invalid ticket because the docstring clearly states that in 3 different, yet critical places, that missing values are not handled here: Each row in the text file must have the same number

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-04-04 Thread Charles R Harris
On Mon, Apr 4, 2011 at 9:59 AM, Bruce Southey bsout...@gmail.com wrote: On 03/31/2011 12:02 PM, Derek Homeier wrote: On 31 Mar 2011, at 17:03, Bruce Southey wrote: This is an invalid ticket because the docstring clearly states that in 3 different, yet critical places, that missing values

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-04-04 Thread Bruce Southey
On 04/04/2011 11:20 AM, Charles R Harris wrote: On Mon, Apr 4, 2011 at 9:59 AM, Bruce Southey bsout...@gmail.com mailto:bsout...@gmail.com wrote: On 03/31/2011 12:02 PM, Derek Homeier wrote: On 31 Mar 2011, at 17:03, Bruce Southey wrote: This is an invalid ticket because

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-04-04 Thread Charles R Harris
On Mon, Apr 4, 2011 at 11:01 AM, Bruce Southey bsout...@gmail.com wrote: On 04/04/2011 11:20 AM, Charles R Harris wrote: On Mon, Apr 4, 2011 at 9:59 AM, Bruce Southey bsout...@gmail.com wrote: On 03/31/2011 12:02 PM, Derek Homeier wrote: On 31 Mar 2011, at 17:03, Bruce Southey wrote:

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-31 Thread Ralf Gommers
On Thu, Mar 31, 2011 at 4:53 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Sun, Mar 27, 2011 at 4:09 AM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On 26. mars 2011, at 21.44, Derek Homeier wrote: Hi Paul, having had a look at the other tickets you dug up, My

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-31 Thread Bruce Southey
On Wed, Mar 30, 2011 at 9:53 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sun, Mar 27, 2011 at 4:09 AM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On 26. mars 2011, at 21.44, Derek Homeier wrote: Hi Paul, having had a look at the other tickets you dug up,

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-31 Thread Ralf Gommers
On Thu, Mar 31, 2011 at 5:03 PM, Bruce Southey bsout...@gmail.com wrote: On Wed, Mar 30, 2011 at 9:53 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sun, Mar 27, 2011 at 4:09 AM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On 26. mars 2011, at 21.44, Derek Homeier wrote:

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-31 Thread Bruce Southey
On 03/31/2011 10:08 AM, Ralf Gommers wrote: On Thu, Mar 31, 2011 at 5:03 PM, Bruce Southeybsout...@gmail.com wrote: On Wed, Mar 30, 2011 at 9:53 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sun, Mar 27, 2011 at 4:09 AM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-31 Thread Derek Homeier
On 31 Mar 2011, at 17:03, Bruce Southey wrote: This is an invalid ticket because the docstring clearly states that in 3 different, yet critical places, that missing values are not handled here: Each row in the text file must have the same number of values. genfromtxt : Load data with

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-31 Thread Bruce Southey
On 03/31/2011 12:02 PM, Derek Homeier wrote: On 31 Mar 2011, at 17:03, Bruce Southey wrote: This is an invalid ticket because the docstring clearly states that in 3 different, yet critical places, that missing values are not handled here: Each row in the text file must have the same number

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-31 Thread Charles R Harris
On Thu, Mar 31, 2011 at 8:42 AM, Ralf Gommers ralf.gomm...@googlemail.comwrote: On Thu, Mar 31, 2011 at 4:53 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Sun, Mar 27, 2011 at 4:09 AM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: snip If you look in Trac under

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-30 Thread Charles R Harris
On Sun, Mar 27, 2011 at 4:09 AM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On 26. mars 2011, at 21.44, Derek Homeier wrote: Hi Paul, having had a look at the other tickets you dug up, My opinions are my own, and in detail, they are: 1752: I attach a possible patch.

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-29 Thread Stéfan van der Walt
On Sun, Mar 27, 2011 at 12:09 PM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: I am sure someone has been using this functionality to convert floats to ints. Changing will break their code. I am not sure how big a deal that would be. Also, I am of the opinion that one should _first_

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-27 Thread Paul Anton Letnes
On 26. mars 2011, at 21.44, Derek Homeier wrote: Hi Paul, having had a look at the other tickets you dug up, My opinions are my own, and in detail, they are: 1752: I attach a possible patch. FWIW, I agree with the request. The patch is written to be compatible with the fix in

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-26 Thread Paul Anton Letnes
Hi! I have had a look at the list of numpy.loadtxt tickets. I have never contributed to numpy before, so I may be doing stupid things - don't be afraid to let me know! My opinions are my own, and in detail, they are: 1752: I attach a possible patch. FWIW, I agree with the request. The

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-26 Thread Pauli Virtanen
Hi, Thanks! On Sat, 26 Mar 2011 13:11:46 +0100, Paul Anton Letnes wrote: [clip] I hope you find this useful! Is there some way of submitting the patches for review in a more convenient fashion than e-mail? You can attach them on the trac to each ticket. That way they'll be easy to find later

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-26 Thread Derek Homeier
Hi, On 26 Mar 2011, at 14:36, Pauli Virtanen wrote: On Sat, 26 Mar 2011 13:11:46 +0100, Paul Anton Letnes wrote: [clip] I hope you find this useful! Is there some way of submitting the patches for review in a more convenient fashion than e-mail? You can attach them on the trac to each

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-26 Thread Derek Homeier
Hi again, On 26 Mar 2011, at 15:20, Derek Homeier wrote: 1562: I attach a possible patch. This could also be the default behavior to my mind, since the function caller can simply call numpy.squeeze if needed. Changing default behavior would probably break old code, Seems the fastest

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-26 Thread Paul Anton Letnes
Hi Derek! On 26. mars 2011, at 15.48, Derek Homeier wrote: Hi again, On 26 Mar 2011, at 15:20, Derek Homeier wrote: 1562: I attach a possible patch. This could also be the default behavior to my mind, since the function caller can simply call numpy.squeeze if needed. Changing default

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-26 Thread Charles R Harris
On Sat, Mar 26, 2011 at 8:53 AM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: Hi Derek! On 26. mars 2011, at 15.48, Derek Homeier wrote: Hi again, On 26 Mar 2011, at 15:20, Derek Homeier wrote: 1562: I attach a possible patch. This could also be the default behavior to

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-26 Thread Derek Homeier
Hi Paul, having had a look at the other tickets you dug up, My opinions are my own, and in detail, they are: 1752: I attach a possible patch. FWIW, I agree with the request. The patch is written to be compatible with the fix in ticket #1562, but I did not test that yet. Tested, see

[Numpy-discussion] loadtxt/savetxt tickets

2011-03-25 Thread Charles R Harris
Hi All, Could someone with an interest in loadtxt/savetxt look through the associated tickets? A search on the tickets using either of those keys will return fairly lengthy lists. Chuck ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] loadtxt stop

2010-09-19 Thread Zachary Pincus
Though, really, it's annoying that numpy.loadtxt needs both the readline function *and* the iterator protocol. If it just used iterators, you could do: def truncator(fh, delimiter='END'): for line in fh: if line.strip() == delimiter: break yield line

[Numpy-discussion] loadtxt stop

2010-09-17 Thread Neil Hodgson
Hi, I been looking around and could spot anything on this. Quite often I want to read a homogeneous block of data from within a file. The skiprows option is great for missing out the section before the data starts, but if there is anything below then loadtxt will choke. I wondered if there

Re: [Numpy-discussion] loadtxt stop

2010-09-17 Thread Neil Hodgson
oops, I meant to save my post but I sent it instead - doh! In the end, the question was; is worth adding start= and stop= markers into loadtxt to allow grabbing sections of a file between two known headers? I imagine it's something that people come up against regularly. Thanks, Neil

Re: [Numpy-discussion] loadtxt stop

2010-09-17 Thread Pierre GM
On Sep 17, 2010, at 2:40 PM, Neil Hodgson wrote: oops, I meant to save my post but I sent it instead - doh! In the end, the question was; is worth adding start= and stop= markers into loadtxt to allow grabbing sections of a file between two known headers? I imagine it's something that

Re: [Numpy-discussion] loadtxt stop

2010-09-17 Thread Christopher Barker
Neil Hodgson wrote: In the end, the question was; is worth adding start= and stop= markers into loadtxt to allow grabbing sections of a file between two known headers? I imagine it's something that people come up against regularly. maybe not so regular. However, a common use would be to be

Re: [Numpy-discussion] loadtxt stop

2010-09-17 Thread Zachary Pincus
In the end, the question was; is worth adding start= and stop= markers into loadtxt to allow grabbing sections of a file between two known headers? I imagine it's something that people come up against regularly. Simple enough to wrap your file in a new file-like object that stops

Re: [Numpy-discussion] loadtxt stop

2010-09-17 Thread Zachary Pincus
Though, really, it's annoying that numpy.loadtxt needs both the readline function *and* the iterator protocol. If it just used iterators, you could do: def truncator(fh, delimiter='END'): for line in fh: if line.strip() == delimiter: break yield line

Re: [Numpy-discussion] loadtxt stop

2010-09-17 Thread Benjamin Root
On Fri, Sep 17, 2010 at 2:50 PM, Zachary Pincus zachary.pin...@yale.eduwrote: Though, really, it's annoying that numpy.loadtxt needs both the readline function *and* the iterator protocol. If it just used iterators, you could do: def truncator(fh, delimiter='END'): for line in fh:

Re: [Numpy-discussion] loadtxt stop

2010-09-17 Thread Zachary Pincus
On Sep 17, 2010, at 3:59 PM, Benjamin Root wrote: So, this code will still raise an error for an empty file. Personally, I consider that a bug because I would expect to receive an empty array. I could understand raising an error for a non-empty file that does not contain anything

Re: [Numpy-discussion] loadtxt stop

2010-09-17 Thread Benjamin Root
On Fri, Sep 17, 2010 at 3:04 PM, Zachary Pincus zachary.pin...@yale.eduwrote: On Sep 17, 2010, at 3:59 PM, Benjamin Root wrote: So, this code will still raise an error for an empty file. Personally, I consider that a bug because I would expect to receive an empty array. I could

Re: [Numpy-discussion] loadtxt() behavior on single-line files

2010-07-27 Thread Benjamin Root
On Thu, Jun 24, 2010 at 1:53 PM, Benjamin Root ben.r...@ou.edu wrote: On Thu, Jun 24, 2010 at 1:00 PM, Warren Weckesser warren.weckes...@enthought.com wrote: Benjamin Root wrote: Hi, I was having the hardest time trying to figure out an intermittent bug in one of my programs.

[Numpy-discussion] loadtxt() behavior on single-line files

2010-06-24 Thread Benjamin Root
Hi, I was having the hardest time trying to figure out an intermittent bug in one of my programs. Essentially, in some situations, it was throwing an error saying that the array object was not an array. It took me a while, but then I figured out that my program was assuming that the object

Re: [Numpy-discussion] loadtxt() behavior on single-line files

2010-06-24 Thread Warren Weckesser
Benjamin Root wrote: Hi, I was having the hardest time trying to figure out an intermittent bug in one of my programs. Essentially, in some situations, it was throwing an error saying that the array object was not an array. It took me a while, but then I figured out that my program was

Re: [Numpy-discussion] loadtxt() behavior on single-line files

2010-06-24 Thread Christopher Barker
Warren Weckesser wrote: Benjamin Root wrote: Note that this isn't restricted to structured arrays. For regular ndarrays, loadtxt() appears to mimic the behavior of np.squeeze(): Exactly. The last four lines of the function are: X = np.squeeze(X) if unpack: return X.T

Re: [Numpy-discussion] loadtxt() behavior on single-line files

2010-06-24 Thread Benjamin Root
On Thu, Jun 24, 2010 at 1:00 PM, Warren Weckesser warren.weckes...@enthought.com wrote: Benjamin Root wrote: Hi, I was having the hardest time trying to figure out an intermittent bug in one of my programs. Essentially, in some situations, it was throwing an error saying that the

[Numpy-discussion] loadtxt raises an exception on empty file

2010-05-24 Thread Maria Liukis
Hello everybody, I'm using numpy V1.3.0 and ran into a case when numpy.loadtxt('foo.txt') raised an exception: import numpy as np np.loadtxt('foo.txt') Traceback (most recent call last): File stdin, line 1, in module File

Re: [Numpy-discussion] loadtxt raises an exception on empty file

2010-05-24 Thread Vincent Davis
On Mon, May 24, 2010 at 4:14 PM, Maria Liukis liu...@usc.edu wrote: Hello everybody, I'm using numpy V1.3.0 and ran into a case when numpy.loadtxt('foo.txt') raised an exception: import numpy as np np.loadtxt('foo.txt') Traceback (most recent call last): File stdin, line 1, in module

Re: [Numpy-discussion] loadtxt raises an exception on empty file

2010-05-24 Thread Nadav Horesh
-discussion@scipy.org Subject: [Numpy-discussion] loadtxt raises an exception on empty file Hello everybody, I'm using numpy V1.3.0 and ran into a case when numpy.loadtxt('foo.txt') raised an exception: import numpy as np np.loadtxt('foo.txt') Traceback (most recent call last): File stdin, line 1

[Numpy-discussion] loadtxt and genfromtxt

2010-02-10 Thread Jonathan Stickel
I am new to python/numpy/scipy and new to this list. I recently migrated over from using Octave and am very impressed so far! Recently I needed to load data from a text file and quickly found numpy's loadtxt function. However, there were missing data values, which loadtxt does not handle.

Re: [Numpy-discussion] loadtxt and genfromtxt

2010-02-10 Thread Ralf Gommers
On Thu, Feb 11, 2010 at 1:36 AM, Jonathan Stickel jjstic...@vcn.com wrote: I am new to python/numpy/scipy and new to this list. I recently migrated over from using Octave and am very impressed so far! Recently I needed to load data from a text file and quickly found numpy's loadtxt

[Numpy-discussion] loadtxt example problem ?

2009-05-04 Thread bruno Piguet
Hello, I'm new to numpy, and considering using loadtxt() to read a data file. As a starter, I tried the example of the doc page ( http://docs.scipy.org/doc/numpy/reference/generated/numpy.loadtxt.html) : from StringIO import StringIO # StringIO behaves like a file object c = StringIO(0

Re: [Numpy-discussion] loadtxt example problem ?

2009-05-04 Thread Ryan May
On Mon, May 4, 2009 at 3:06 PM, bruno Piguet bruno.pig...@gmail.com wrote: Hello, I'm new to numpy, and considering using loadtxt() to read a data file. As a starter, I tried the example of the doc page ( http://docs.scipy.org/doc/numpy/reference/generated/numpy.loadtxt.html) : from

Re: [Numpy-discussion] loadtxt issues

2009-03-04 Thread Sturla Molden
On 2/11/2009 6:40 AM, A B wrote: Hi, How do I write a loadtxt command to read in the following file and store each data point as the appropriate data type: 12|h|34.5|44.5 14552|bbb|34.5|42.5 dt = {'names': ('gender','age','weight','bal'), 'formats': ('i4', 'S4','f4', 'f4')} Does this

Re: [Numpy-discussion] loadtxt issues

2009-03-04 Thread Sturla Molden
On 3/4/2009 12:57 PM, Sturla Molden wrote: Does this work for you? Never mind, it seems my e-mail got messed up. I ought to keep them sorted by date... S.M. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org

Re: [Numpy-discussion] loadtxt slow

2009-03-02 Thread Michael S. Gilbert
On Sun, 1 Mar 2009 14:29:54 -0500, Michael Gilbert wrote: i will send the current version to the list tomorrow when i have access to the system that it is on. attached is my current version of loadtxt. like i said, it's slower for small data sets (because it reads through the whole data file

[Numpy-discussion] loadtxt slow

2009-03-01 Thread Gideon Simpson
So I have some data sets of about 16 floating point numbers stored in text files. I find that loadtxt is rather slow. Is this to be expected? Would it be faster if it were loading binary data? -gideon ___ Numpy-discussion mailing list

Re: [Numpy-discussion] loadtxt slow

2009-03-01 Thread Michael Gilbert
On Sun, 1 Mar 2009 16:12:14 -0500 Gideon Simpson wrote: So I have some data sets of about 16 floating point numbers stored in text files. I find that loadtxt is rather slow. Is this to be expected? Would it be faster if it were loading binary data? i have run into this as well.

Re: [Numpy-discussion] loadtxt slow

2009-03-01 Thread Michael Gilbert
On Sun, 1 Mar 2009 14:29:54 -0500 Michael Gilbert wrote: i have rewritten loadtxt to be smarter about allocating memory, but it is slower overall and doesn't support all of the original arguments/options (yet). i had meant to say that my version is slower for smaller data sets (when you

Re: [Numpy-discussion] loadtxt slow

2009-03-01 Thread Brent Pedersen
On Sun, Mar 1, 2009 at 11:29 AM, Michael Gilbert michael.s.gilb...@gmail.com wrote: On Sun, 1 Mar 2009 16:12:14 -0500 Gideon Simpson wrote: So I have some data sets of about 16 floating point numbers stored in text files.  I find that loadtxt is rather slow.  Is this to be expected?  

Re: [Numpy-discussion] loadtxt slow

2009-03-01 Thread Eric Firing
Gideon Simpson wrote: So I have some data sets of about 16 floating point numbers stored in text files. I find that loadtxt is rather slow. Is this to be expected? Would it be faster if it were loading binary data? Depending on the format you may be able to use numpy.fromfile, which

Re: [Numpy-discussion] loadtxt issues

2009-02-11 Thread A B
On Tue, Feb 10, 2009 at 9:52 PM, Brent Pedersen bpede...@gmail.com wrote: On Tue, Feb 10, 2009 at 9:40 PM, A B python6...@gmail.com wrote: Hi, How do I write a loadtxt command to read in the following file and store each data point as the appropriate data type: 12|h|34.5|44.5

Re: [Numpy-discussion] loadtxt issues

2009-02-11 Thread A B
On Wed, Feb 11, 2009 at 6:27 PM, A B python6...@gmail.com wrote: On Tue, Feb 10, 2009 at 9:52 PM, Brent Pedersen bpede...@gmail.com wrote: On Tue, Feb 10, 2009 at 9:40 PM, A B python6...@gmail.com wrote: Hi, How do I write a loadtxt command to read in the following file and store each data

Re: [Numpy-discussion] loadtxt issues

2009-02-11 Thread Scott Sinclair
2009/2/12 A B python6...@gmail.com: Actually, I was using two different machines and it appears that the version of numpy available on Ubuntu is seriously out of date (1.0.4). Wonder why ... See the recent post here

[Numpy-discussion] loadtxt issues

2009-02-10 Thread A B
Hi, How do I write a loadtxt command to read in the following file and store each data point as the appropriate data type: 12|h|34.5|44.5 14552|bbb|34.5|42.5 Do the strings have to be read in separately from the numbers? Why would anyone use 'S10' instead of 'string'? dt = {'names':

Re: [Numpy-discussion] loadtxt issues

2009-02-10 Thread Brent Pedersen
On Tue, Feb 10, 2009 at 9:40 PM, A B python6...@gmail.com wrote: Hi, How do I write a loadtxt command to read in the following file and store each data point as the appropriate data type: 12|h|34.5|44.5 14552|bbb|34.5|42.5 Do the strings have to be read in separately from the numbers?

Re: [Numpy-discussion] Loadtxt .bz2 support

2008-10-22 Thread Ryan May
Charles R Harris wrote: On Tue, Oct 21, 2008 at 1:30 PM, Ryan May [EMAIL PROTECTED] wrote: Hi, I noticed numpy.loadtxt has support for gzipped text files, but not for bz2'd files. Here's a 3 line patch to add bzip2 support to loadtxt. Ryan -- Ryan May Graduate Research Assistant

[Numpy-discussion] Loadtxt .bz2 support

2008-10-21 Thread Ryan May
Hi, I noticed numpy.loadtxt has support for gzipped text files, but not for bz2'd files. Here's a 3 line patch to add bzip2 support to loadtxt. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma Index: numpy/lib/io.py

  1   2   >