以下是 Python 代码,实现删除数组中存在指定列名的两列:
def remove_columns(array, column_names):
columns_to_remove = []
for column_name in column_names:
if column_name in array.dtype.names:
columns_to_remove.append(column_name)
return array[columns_to_remove]