How can I detect and exclude outliers in a pandas DataFrame using Python?

I’m working with a Pandas dataframe and need to detect and exclude any outliers in the data. I’ve tried using the z-score method and setting a threshold value, but it seems to be removing too many valid data points. Can anyone suggest a more effective method for identifying and removing outliers in a Panda dataframe? I can provide a sample of my data if that would be helpful.

Here’s the sample dataframe of my code:

import pandas as pd
import numpy as np

# create a dummy dataframe
df = pd.DataFrame({'A': np.random.randint(1, 100, 100),
                   'B': np.random.normal(50, 10, 100),
                   'C': np.random.normal(10, 5, 100)})