1-е решение трактует никто как символ, а не NaN, мы используем eq
с sum
(если нужно сбросить row
, используя sum(axis=1)
)
df.loc[:,df.eq('none').sum().lt(2)]
Out[559]:
# of customers Category
0 30 none
1 none women
2 50 kids
2-е решение предполагает, что вы не имеетекак np.nan
и использование dropna
с thresh
#df=df.replace('none',np.nan)
df.dropna(axis=0,thresh=2)#here thresh is Require that many non-NA values.
Out[563]:
# of customers Category Sales
2 50 kids 40