Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

numpy remove columns containing nan

a = a[~(np.isnan(a).any(axis=0))] # removes columns containing at least one nan
a = a[~(np.isnan(a).all(axis=0))] # removes columns containing all nan

Source by note.nkmk.me #
 
PREVIOUS NEXT
Tagged: #numpy #remove #columns #nan
ADD COMMENT
Topic
Name
5+2 =