I have another basic question, that I haven\'t been able to find the answer for, but it seems like something that should be easy to do.
Ok, imagine you have a structured
Having googled my way here and learned what I needed to know from Warren's answer, I couldn't resist posting a more succinct version, with the added option to remove multiple fields efficiently in one go:
def rmfield( a, *fieldnames_to_remove ):
return a[ [ name for name in a.dtype.names if name not in fieldnames_to_remove ] ]
Examples:
a = rmfield(a, 'foo')
a = rmfield(a, 'foo', 'bar') # remove multiple fields at once
Or if we're really going to golf it, the following is equivalent:
rmfield=lambda a,*f:a[[n for n in a.dtype.names if n not in f]]