[Numpy-discussion] loadtxt and usecols

Zbyszek Szmek zbyszek@in.waw...
Mon Jul 14 10:13:55 CDT 2008


> data = loadtxt('18B180.dat', skiprows = 1, usecols = xrange(1,46))
On Sat, Jul 12, 2008 at 04:35:20PM +0200, Lorenzo Bolla wrote:
> why not using:
or data = loadtxt('18B180.dat', skiprows=1, unpack=True)[1:]

> 
> obviously, you need to know how many columns you have.
Or not, if you don't mind the very small cost of parsing an extra column.

-
Zbyszek

> 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 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 something like,
> > 
> > data = loadtxt('18B180.dat', skiprows = 1, usecols = (1,:))
> > 
> > the first column is the only that i do not need.


More information about the Numpy-discussion mailing list