PyPSA / powerplantmatching

Set of tools to combine multiple power plant databases
https://powerplantmatching.readthedocs.io/en/latest/
GNU General Public License v3.0
156 stars 54 forks source link

AttributeError: 'DataFrame' object has no attribute 'append' #176

Closed cshearer1977 closed 3 months ago

cshearer1977 commented 3 months ago

When running pm.powerplants(reduced=False) I hit the following error: AttributeError: 'DataFrame' object has no attribute 'append'

According to Stack Overflow, the append function has been removed as of pandas 2.0: https://stackoverflow.com/questions/75956209/error-dataframe-object-has-no-attribute-append

Context:

~/opt/miniconda3/envs/powerplantmatching/lib/python3.12/site-packages/powerplantmatching/collection.py in ?(config, config_update, update, from_url, extend_by_vres, extendby_kwargs, extend_by_kwargs, fill_geopositions, filter_missing_geopositions, **collection_kwargs)
    233         for source in config["fully_included_sources"]:
    234             source = to_dict_if_string(source)
    235             (name,) = list(source)
    236             extend_by_kwargs.update({"query": source[name]})
--> 237             matched = extend_by_non_matched(
    238                 matched, name, config=config, **extend_by_kwargs
    239             )
    240 

~/opt/miniconda3/envs/powerplantmatching/lib/python3.12/site-packages/powerplantmatching/heuristics.py in ?(df, extend_by, label, query, aggregate_added_data, config, **aggkwargs)
     89             projectID=extend_by.projectID.map(lambda x: {label: [x]})
     90         )
     91 
     92     if df.columns.nlevels > 1:
---> 93         return df.append(
     94             # , ignore_index=True ??
     95             pd.concat([extend_by], keys=[label], axis=1)
     96             .swaplevel(axis=1)

~/opt/miniconda3/envs/powerplantmatching/lib/python3.12/site-packages/pandas/core/generic.py in ?(self, name)
   6295             and name not in self._accessors
   6296             and self._info_axis._can_hold_identifiers_and_holds_name(name)
   6297         ):
   6298             return self[name]
-> 6299         return object.__getattribute__(self, name)

AttributeError: 'DataFrame' object has no attribute 'append'