snap-stanford / SATURN

MIT License
105 stars 17 forks source link

.append() does not exist anymore in pandas #22

Closed anaellle closed 1 year ago

anaellle commented 1 year ago

Hello,

I am using SATURN to integrate cross-species scRNA-Seq data. I am able to run train-saturn.py and it seems to be doing well until I get this error :

"../../train-saturn.py", line 820, in trainer scores_df = scores_df.append(mmd_row, ignore_index=True) AttributeError: 'DataFrame' object has no attribute 'append'. Did you mean: '_append'?

I have pandas version '2.0.1' and apparently df.append() is not available anymore after pandas '1.4'. Would that be possible to specify which version of pandas you are using ?

Otherwise I would suggest to use pd.concat() which is the alternative proposed by pandas (this is what I am currently trying to do).

Thank you ! Anaëlle

Yanay1 commented 1 year ago

Hi, thanks for pointing out this issue!

You should be able to replace that line with: scores_df = pd.concat((scores_df, pd.DataFrame([mmd_row])), ignore_index=True)

Please let me know if that works!

anaellle commented 1 year ago

Hi, yes it worked ! Thank you for your help. This issue is at lines 818, 820 and 847. I take this opportunity to tell you as well that so far I found SATURN easy to use. The only thing I could suggest would be to specify that the var_names of the adata objects should be the gene names in the README file. Otherwise it is really clear. Thank you again !

Yanay1 commented 1 year ago

Glad to hear that, thanks for the feedback!

cchd0001 commented 7 months ago

Hi, yes it worked ! Thank you for your help. This issue is at lines 818, 820 and 847. I take this opportunity to tell you as well that so far I found SATURN easy to use. The only thing I could suggest would be to specify that the var_names of the adata objects should be the gene names in the README file. Otherwise it is really clear. Thank you again !

Meet the same issue, thanks

matejasoretic commented 6 months ago

Hi, I had the same issue and replaced the lines 818, 820 and 847, but I am still getting an issue

 line 818, in trainer
    scores_df = pd.concat((scores_df, pd.DataFrame([mmd_row])), ignore_index=True)
UnboundLocalError: local variable 'mmd_row' referenced before assignment

Edited: Sorry, I was just silly, I see that the replacement is not exactly the same for each of the three row, but rather

scores_df = pd.concat((scores_df, pd.DataFrame([lr_row])), ignore_index=True) scores_df = pd.concat((scores_df, pd.DataFrame([mmd_row])), ignore_index=True) scores_df = pd.concat((scores_df, pd.DataFrame([lr_cross_row])), ignore_index=True)

dariotommasini commented 5 months ago

Hi. Can train_saturn.py be updated with these changed?