Хочу замаскировать часть значений в массиве дабы его потом вывести матплотлибом, столкнулся со следующей проблемой:
import numpy as np
xs = np.empty([2,3,4])
ms = np.vectorize(lambda x: x>0)(xs)
np.ma.array(xs, ms)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-b2506d35ffe6> in <module>()
----> 1 np.ma.array(xs, ms)
/usr/lib/python3/dist-packages/numpy/ma/core.py in array(data, dtype, copy, order, mask, fill_value, keep_mask, hard_mask, shrink, subok, ndmin)
5810 return MaskedArray(data, mask=mask, dtype=dtype, copy=copy, subok=subok,
5811 keep_mask=keep_mask, hard_mask=hard_mask,
-> 5812 fill_value=fill_value, ndmin=ndmin, shrink=shrink)
5813 array.__doc__ = masked_array.__doc__
5814
/usr/lib/python3/dist-packages/numpy/ma/core.py in __new__(cls, data, mask, dtype, copy, subok, ndmin, fill_value, keep_mask, hard_mask, shrink, **options)
2635 """
2636 # Process data............
-> 2637 _data = np.array(data, dtype=dtype, copy=copy, subok=True, ndmin=ndmin)
2638 _baseclass = getattr(data, '_baseclass', type(_data))
2639 # Check that we're not erasing the mask..........
TypeError: data type not understood
np.ma.masked_where(xs<0, xs)