def ffill_across_cols(df, columns, name_map):
 df.ffill(inplace=True)
 for column in columns:
  column_name = name_map[column.name]
  if (column.dtype == categorical_dtype):
   df[column_name] = df[column.name].where(pd.notnull(df[column_name]), column.missing_value)
  else:
   df[column_name] = df[column_name].fillna(column.missing_value).astype(column.dtype)

def ffill_across_cols ( df , columns , name_map ) : df . ffill ( inplace = True ) for column in columns : column_name = name_map [ column . name ] if ( column . dtype == categorical_dtype ) : df [ column_name ] = df [ column . name ] . where ( pd . notnull ( df [ column_name ] ) , column . missing_value ) else : df [ column_name ] = df [ column_name ] . fillna ( column . missing_value ) . astype ( column . dtype )
forward fill values in a dataframe with special logic to handle cases that pd .