set scaler between a and b pandas code example

Example 1: values outside range pandas

# Get rid of values inside a range for a defined column
df = df[~df['column_name'].between(lower_boundary,upper_boundary)]

Example 2: python function to scale selected features in a dataframe pandas

# make a copy of dataframe
scaled_features = df.copy()

col_names = ['co_1', 'col_2', 'col_3', 'col_4']
features = scaled_features[col_names]

# Use scaler of choice; here Standard scaler is used
scaler = StandardScaler().fit(features.values)
features = scaler.transform(features.values)

scaled_features[col_names] = features