input: Write a function to detect outliers in a dataset and replace them with the mean using z-score.
  assert detect_outliers(pd.Series([1.2, 3.4, 4.5, 3.1, 2.2, 4.9, 4.2, 2.1, 1.1, 5.1, 5.2])).equals(pd.Series([1.2, 3.4, 4.5, 3.1, 2.2, 4.9, 4.2, 2.1, 1.1, 5.1, 5.2]))
  assert detect_outliers(pd.Series([10, 20, 30, 40, 1000])).equals(pd.Series([10, 20, 30, 40, 25]))
  assert detect_outliers(pd.Series([-100, -50, 0, 50, 100])).equals(pd.Series([-100, -50, 0, 50, 100]))
output: import pandas as pd
  from scipy.stats import zscore
  
  def detect_outliers(data):
      z_scores = zscore(data)
      mean_value = data.mean()
      outliers_replaced = data.where((z_scores < 3) & (z_scores > -3), mean_value)
      return outliers_replaced