[Numpy-discussion] Difference between np.loadtxt depending on whether you supply a file object or a filename

Andrew Nelson andyfaff@gmail....
Mon Aug 20 05:55:21 CDT 2012


Dear list,
I observe a difference when I try to load a 2D numpy array from a file
object compared to if I supply a filename viz:

>>> np.version.version
'1.5.1'
>>> f=open('fit_theoretical.txt')
>>> a=np.loadtxt(f)
>>> a.shape
(1000,)
>>> a=np.loadtxt('fit_theoretical.txt')
>>> a.shape
(500, 2)

This strikes me as unexpected, it's not a documented behaviour. Any ideas?

cheers,
Andrew.


-- 
_____________________________________
Dr. Andrew Nelson


_____________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120820/070f4919/attachment.html 


More information about the NumPy-Discussion mailing list