handle both normal and MultiIndex dataframes.