I have a dataframe with a length of 1168 and 270 columns.
The goal is the title: Remove outliers from all 270 columns that are more than +/- 3 standard deviations away from the mean.
My code is the following. However, it only keeps 40 datapoints. This doesnt make sense since it originally has 1168 rows, which means its only keeping 3% of the entire dataset.
from scipy import stats
len(df[(np.abs( stats. zscore(df)) < 3). all(axis = 1)])