original_docstring: 
      Function to transform data, loosly based on prepare_missing.m
  
      Parameters
      ----------
      raw_df : pd.DataFrame
      
docstring: Function to transform data, loosly based on prepare_missing.m
  Parameters
  
  
docstring_tokens: Function to transform data loosly based on prepare_missing . m Parameters
code: def normalize(raw_df: pd.DataFrame) -> pd.DataFrame:
      """
      Function to transform data, loosly based on prepare_missing.m
  
      Parameters
      ----------
      raw_df : pd.DataFrame
      """
  
      na_latest = raw_df.iloc[-1].isna().all()
  
      if na_latest:
          raw_df = raw_df.iloc[:-1]
  
      dates = pd.DatetimeIndex(raw_df.loc[1:, "sasdate"], freq="MS")
      
      core_data = raw_df.loc[1:, "RPI":].copy().set_index(dates)
      variables = core_data.columns
  
      codes = raw_df.iloc[0, 1:].astype(int)
  
      transf_df = pd.DataFrame(columns = variables, index = dates)
  
      for variable, code in zip(variables, codes):
          
          transf_fn = cases[code]
  
          raw_series = core_data[variable]
          transf_df[variable] = transf_fn(raw_series)
  
  
      return transf_df
code_tokens: def normalize ( raw_df : pd . DataFrame ) -> pd . DataFrame : na_latest = raw_df . iloc [ - 1 ] . isna ( ) . all ( ) if na_latest : raw_df = raw_df . iloc [ : - 1 ] dates = pd . DatetimeIndex ( raw_df . loc [ 1 : , "sasdate" ] , freq = "MS" ) core_data = raw_df . loc [ 1 : , "RPI" : ] . copy ( ) . set_index ( dates ) variables = core_data . columns codes = raw_df . iloc [ 0 , 1 : ] . astype ( int ) transf_df = pd . DataFrame ( columns = variables , index = dates ) for variable , code in zip ( variables , codes ) : transf_fn = cases [ code ] raw_series = core_data [ variable ] transf_df [ variable ] = transf_fn ( raw_series ) return transf_df
short_docstring: Function to transform data, loosly based on prepare_missing.m
  Parameters
short_docstring_tokens: Function to transform data loosly based on prepare_missing . m Parameters
comment: """
      Function to transform data, loosly based on prepare_missing.m
  
      Parameters
      ----------
      raw_df : pd.DataFrame
      """