def df_to_records(df):
    """ Convert pandas DataFrame to table compatible data aka records. If DataFrame is empty keep the columns.
    
    :type df: pandas.DataFrame
    :rtype: list[dict]
    """
    if df.empty:
        # Return column names in 'records' style.
        return [{c: None for c in df.columns}]
    return df.to_dict('records')