ENH/REF: refactor dataframe formatting