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

Andrew Nelson andyfaff at gmail.com
Mon Aug 20 06:55:21 EDT 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
>>> f=open('fit_theoretical.txt')
>>> a=np.loadtxt(f)
>>> a.shape
>>> a=np.loadtxt('fit_theoretical.txt')
>>> a.shape
(500, 2)

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


Dr. Andrew Nelson

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

More information about the NumPy-Discussion mailing list