code: def _winsorize_wrapper(x, limits):
      
      if isinstance(x, pd.Series):
          if x.count() == 0:
              return x
  
          notnanx = ~np.isnan(x)
          x[notnanx] = scipy.stats.mstats.winsorize(x[notnanx],
                                                    limits=limits)
          return x
      else:
          return scipy.stats.mstats.winsorize(x, limits=limits)
docs: Wraps scipy winsorize function to drop na's