已多次詢問和回答此問題(例如,here和here)。顯然這個功能已經在numpy 1.6.1中移動了。沒有更多numpy.lib.recfunctions
。雖然我可以實現我自己的以前的帖子中指定,我會真的而不是!將字段添加到結構化numpy數組(3)
有人能告訴我這個函數的路徑嗎?作爲一個整體已被移動或合併到另一個圖書館?
已多次詢問和回答此問題(例如,here和here)。顯然這個功能已經在numpy 1.6.1中移動了。沒有更多numpy.lib.recfunctions
。雖然我可以實現我自己的以前的帖子中指定,我會真的而不是!將字段添加到結構化numpy數組(3)
有人能告訴我這個函數的路徑嗎?作爲一個整體已被移動或合併到另一個圖書館?
根據git history,numpy.lib.recfunctions
還沒有去過任何地方。
我會檢查你的numpy安裝,也許將其升級到更新的版本。
這適用於我...但我不清楚爲什麼。也許有人可以解釋:
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__version__
'1.6.1'
>>> numpy.lib
<module 'numpy.lib' from 'C:\Python27\ArcGIS10.1\lib\site-packages\numpy\lib\__init__.pyc'>
>>> numpy.lib.recfunctions #### <- why does this not work?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'recfunctions'
>>> import numpy.lib.recfunctions
>>> dir(numpy.lib.recfunctions)
['MaskedArray', 'MaskedRecords', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_check_fill_value', '_fix_defaults', '_fix_output','_is_string_like', '_izip_fields', '_izip_fields_flat', 'append_fields', 'drop_fields', 'find_duplicates', 'flatten_descr', 'get_fieldstructure', 'get_names', 'get_names_flat', 'itertools', 'izip_records', 'join_by', 'ma', 'merge_arrays', 'ndarray', 'np', 'rec_append_fields', 'rec_drop_fields', 'rec_join', 'recarray', 'recursive_fill_fields', 'rename_fields', 'stack_arrays', 'sys', 'zip_descr']
>>>
我發現,追加數組到一個記錄陣列,使用MLAB recfunctions是確定的,但numpy的recfunctions也不行。
import matplotlib.mlab as mlab
mlab.rec_append_fields(recarray, names, data)
好的。感謝那。我已經找到了庫和函數,所以我想我有一些時髦的w /我的配置。將回報。 – Roland
在新系統上使用linux/conda遇到了這個問題。必須在頂部添加一個「import numpy.lib.recfunctions」調用。 – pyCthon