File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -659,7 +659,7 @@ def inventory_df(
659659 ) -> pd .DataFrame :
660660 """Return an inventory dataframe with metadata of the given type."""
661661 try :
662- data = self .inventory_data [inventory_type ]
662+ data = deepcopy ( self .inventory_data [inventory_type ])
663663 appending = columns .difference (set (data [3 ]))
664664 for clmn in appending :
665665 data [3 ].append (clmn )
@@ -762,10 +762,10 @@ def aggregate_by_parameters(
762762
763763 df = pd .DataFrame (contributions ).T
764764 columns = list (range (contributions .shape [0 ]))
765- df .index = pd . MultiIndex . from_tuples ( rev_index .values () )
766- metadata = AB_metadata .get_metadata ( list ( keys ), fields )
765+ df .index = rev_index .values ()
766+ metadata = AB_metadata .dataframe . loc [ AB_metadata . dataframe [ "id" ]. isin ( keys ), fields + [ "id" ]]
767767
768- joined = metadata .join (df )
768+ joined = metadata .merge (df , left_on = "id" , right_index = True , how = "left" )
769769 joined .reset_index (inplace = True , drop = True )
770770 grouped = joined .groupby (parameters )
771771 aggregated = grouped [columns ].sum ()
You can’t perform that action at this time.
0 commit comments