recfromcsv, genfromtxt, recfromtxt mysteriously missing from numpy
I am used to using numpy.recfromcsv to load csv files as record arrays in python.
However on my new laptop (MB pro running OS 10.6.6), numpy doesn't seem to recognize recfromcsv as a function (same with genfromtxt or recfromtxt).
>>> import numpy as np
>>> np.recfromcsv
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'recfromcsv'
Why would this happen? I have never seen this before and everywhere I look it seems as though recfromcsv (and the rest) should be basic numpy functions. I am working with the native install of python on my machine (Python 2.6.1), and with the version of numpy comes with the Mac OS开发者_StackOverflow中文版.
>>> reload(np)
<module 'numpy' from '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy/__init__.py'>
If you look at:
np.version.version
you'll see that on mac it's version 1.2.1 (at least on my machine). np.recfromcsv
was likely added in a newer release of numpy so that's why you're missing it along with the other methods.
This is a fairly old version of numpy, so you should think about upgrading. And I recommend not messing with the version of python in /usr/bin. Instead install a fresh python build in a different location and then use your .bash_profile to have it place the location of that version ahead of the location of the builtin.
精彩评论