Adding a field to a structured numpy array

后端 未结 2 1947
时光取名叫无心
时光取名叫无心 2020-11-30 10:59

What is the cleanest way to add a field to a structured numpy array? Can it be done destructively, or is it necessary to create a new array and copy over the existing field

2条回答
  •  半阙折子戏
    2020-11-30 11:40

    If you're using numpy 1.3, there's also numpy.lib.recfunctions.append_fields().

    For many installations, you'll need to import numpy.lib.recfunctions to access this. import numpy will not allow one to see the numpy.lib.recfunctions

提交回复
热议问题