frankligy / scTriangulate

scTriangulate is a Python package to mix-and-match conflicting clustering results in single cell analysis and generate reconciled clustering solutions
MIT License
35 stars 5 forks source link

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

Open frankligy opened 1 year ago

frankligy commented 1 year ago

It has been brought to my attention that a new change post pandas v2 will break the gseapy function due to the deprecated .append() function, you may encounter error like below:

Traceback (most recent call last):

  File “/.../pool.py", line 125, in worker

    result = (True, func(*args, **kwds))

  File /.../sctriangulate/main_class.py", line 2961, in each_key_run

    marker_genes = marker_gene(adata_to_compute,key,species,criterion,folder)

  File “/.../sctriangulate/metrics.py", line 202, in marker_gene

    enrichr_dict = run_enrichr(result.loc[cluster,:].to_list()[0],key=key,name=cluster,folder=folder,species=species,criterion=criterion)  # [0] because it is a [[gene_list]],we only need [gene_list]

  File “/.../sctriangulate/metrics.py", line 64, in run_enrichr

    enr2 = gp.enrichr(gene_list=gene_list,

  File "/.../gseapy/enrichr.py", line 502, in enrichr

    enr.run()

  File “/.../gseapy/enrichr.py", line 409, in run

    self.results = self.results.append(res, ignore_index=True)

  File “/.../pandas/core/generic.py", line 6204, in __getattr__

    return object.__getattribute__(self, name)

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

In that case, the solution is to downgrade pandas, In the attached ipynb pdf tested on python 3.10, I downgrade to 1.5.3 and it worked very well.

run_sctri.ipynb - Colaboratory.pdf

Screenshot 2023-11-06 at 3 18 25 PM