Is there an easy way to check if a numpy array is masked or not?
I am currently checking if marr is marr or not:
marr
try: arr = marr.data except: arr = marr
You can use the python isinstance function to check if an object is an instance of a class.
isinstance
>>> isinstance(np.ma.array(np.arange(10)),np.ma.MaskedArray) True >>> isinstance(np.arange(10),np.ma.MaskedArray) False
Source: https://habr.com/ru/post/1259302/More articles:How to unsubscribe from Observable returned by forkJoin? - angularHow can I train a neural network for a 2048 game? - pythonUsing extension methods in RoslynPad - c #Bundler finds the wrong version of ruby - ruby | fooobar.comError: extension methods must be defined in a static top-level class (CS1109) - c #How to bind a call to an FFI function that uses VarArgs in Rust? - rustAndroid EditText Binding is interrupted after updating MvvmCross from 4.2.3 to 4.4.0 with Linker enabled - androidhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1259305/new-column-in-pandas-adding-series-to-dataframe-by-applying-a-list-groupby&usg=ALkJrhiFS4Da3VuwUGBKBXYXs1Cro_iRfApandas how to use groupby to group columns by date in label? - pythonHow to load PEM Elliptic Curve public keys into Bouncy Castle? - javaAll Articles