Skip to main content

pandas_utils

append_index

def append_index(df: Optional[DataFrame]) -> Optional[DataFrame]

Add a numerical index column to the dataframe

remove_index

def remove_index(value: value_type) -> value_type

If value is a DataFrame, remove the index column from it.

Otherwise return same value untouched.

df_convert_to_internal

def df_convert_to_internal(original_df: DataFrame) -> DataFrame

Convert a DataFrame to an internal format, with the following modifications:

  • Flatten hierarchical columns to a single level
  • Append a numeric index suffix to all columns
  • Reset each index and append it as a special column