Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unsupported operand type error in preprocessing #29

Open
lillyzhan opened this issue May 7, 2024 · 3 comments
Open

unsupported operand type error in preprocessing #29

lillyzhan opened this issue May 7, 2024 · 3 comments

Comments

@lillyzhan
Copy link

lillyzhan commented May 7, 2024

Dear professor,
I am getting this TypeError: unsupported operand type(s) for &: 'str' and 'str' error in the function preprocessing in utils.py on the line 205. I tought that genes_shared should be a number but adata_st.var.index are list of strings. Could you help me fix the error or explain what the line of code genes_shared = adata_st.var.index & adata_st_new.var.index is meant to do?
This error only appears in the windows system.

Thanks in advance.
Lilly

@gefeiwang
Copy link
Collaborator

Hi Lilly,

The command (genes_shared = adata_st.var.index & adata_st_new.var.index) selects genes that are measured in both single-cell spatial transcriptomics data. The error message TypeError: unsupported operand type(s) for &: 'str' and 'str' is very likely to be caused by using a pandas version in which the intersection between two pandas.Index objects using '&' is not supported. May I know the pandas package version you are using?

Best,
Gefei

@lillyzhan
Copy link
Author

Hi Professor,

The pandas version is 2.0.3. Thanks for the explanation.

Best regards,
Lilly

@gefeiwang
Copy link
Collaborator

Downgrading pandas to a version <=1.5.3 may help fix the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants