code: def empirical_cdf(data):
      
  
      vals = pd.Series(data).value_counts()
      ecdf = pd.DataFrame(data).set_index(keys=0)
      probs = pd.DataFrame(vals.sort_index().cumsum() / np.float(len(data)))
      ecdf = ecdf.join(probs)
      ecdf = ecdf.reset_index()
      ecdf.columns = ['data', 'ecdf']
  
      return ecdf
docs: Generates an empirical cdf from data
  
      Parameters
      ----------
      data : iterable
          Empirical data
  
      Returns
      --------
      DataFrame
          Columns 'data' and 'ecdf'. 'data' contains ordered data and 'ecdf'
          contains the corresponding ecdf values for the data.