Here's how you can do this in Pandas:

df = pd.DataFrame({'x': [1, 1, 1, 2, 2, 2], 'y': ['a', 'b', 'a', 'a', 'a', 'b'], 'z': ['c', 'b', 'c', 'c', 'c', 'c']})

# Create a mask to only keep rows where the value in column 'z' is not 'b'
mask = df['z'] != 'b'

# Filter the dataframe using the mask
df = df[mask]

# Group by column 'x'
grouped = df.groupby('x')

# Find the average occurrence of the value 'a' in column 'y' per group
result = grouped['y'].apply(lambda x: (x == 'a').mean())

This will give you a new pandas Series with the average occurrence of the value 'a' in column 'y' per group of column 'x'.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence