[SciPy-User] Loadtxt vs genfromtxt

Bjorn Burr Nyberg bjorn.burr.nyberg@gmail....
Thu Mar 1 04:14:41 CST 2012

I have a general question about loading data into numpy as I want to compare numpy and r by loading the juraset.dat ASCII file from the gstat package. Reading the support documents I have decided that it is better to use the loadtxt function as I do not have any missing data as useful by the genfromtxt function. However I receive this error when running loadtxt:

File ..... Numpy\lib\npyio.py, line 796, in loadtxt
Items = [conv(Val) for (conv,val) in zip(converts,Vals)]
ValueError: invalid literal for float()

Using the same parameters but with genfromtxt works, although the first entry of the array is Nan(not a numeric - expected a header like in a data frame of r). I suppose I was wondering if there was any way to save header data of an array whereby one could simply call that header for the data?Do I just have to remember the data associated with each column and call using data[]? Even loading the data as x,y,z = loadtxt is problematic when there are several columns associated with the data that I do not necessarily remember offhand.

Thanks for any advice and with your patience as I'm rather new to Numpy.

More information about the SciPy-User mailing list