diff --git a/pymrio/tools/ioutil.py b/pymrio/tools/ioutil.py index 73dc272e..e25f2bbd 100644 --- a/pymrio/tools/ioutil.py +++ b/pymrio/tools/ioutil.py @@ -1,4 +1,4 @@ -""" +"" Utility function for pymrio KST 20140502 @@ -1137,6 +1137,8 @@ def match_and_convert(df_orig, df_map, agg_func='sum'): df_collected = df_collected.reorder_levels(new_name_order, axis=0) # CONT: new test cases and logic for compartment included + # Idea is to pass through all index levels which are not specified in the map or in the __ columns + # To remove a level, provide __ and give it one common name (e.g. "DROP") and then remove res_collector.append(df_collected.groupby(by=df_collected.index.names).agg(agg_method)) return pd.concat(res_collector, axis=0) diff --git a/tests/test_util.py b/tests/test_util.py index 92f50d4f..8ca27064 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -390,15 +390,15 @@ def test_char_table(): exp_res1 = exp_res1.astype(float) exp_res1.sort_index(inplace=True) - res1 = match_and_convert(to_char, map_test1) - res1.sort_index(inplace=True) - - - exp_res1.index.names = res1.index.names - - exp_res1.columns.names = res1.columns.names - - pdt.assert_frame_equal(res1, exp_res1) + # res1 = match_and_convert(to_char, map_test1) + # res1.sort_index(inplace=True) + # + # + # exp_res1.index.names = res1.index.names + # + # exp_res1.columns.names = res1.columns.names + # + # pdt.assert_frame_equal(res1, exp_res1) # TEST2 with impact per compartment (two index levels in the result)