I have a pandas data frame with 5 columns: X, Y Z, Value1, Value2.
I want to compute Z score based on column Value 1, and then apply it. I can't figure out how to do it properly. I have tried both
from scipy import stats
z_score = np.abs(stats.zscore(df["Value1"]))
df["Value1"] = df["Value1"][(z_score < 3).all(axis=1)]
and
from scipy.stats import zscore
df["Value1"].apply(zscore)
but non seems to work properly. Not sure what to do since I either key a
KeyError: False or IndexError: tuple index out of range.