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
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
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
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
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
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.
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
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.
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
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
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,
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
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
i would like to load my data without knowing the length, i have explicitly
stated the rows
data = loadtxt('18B180.dat', skiprows = 1, usecols =
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45))
and would like to use
why not using:
data = loadtxt('18B180.dat', skiprows = 1, usecols = xrange(1,46))
obviously, you need to know how many columns you have.
hth,
L.
On Sat, Jul 12, 2008 at 10:07:06AM -0400, Bryan Fodness wrote:
i would like to load my data without knowing the length, i have explicitly
stated the
15 matches
Mail list logo