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

Method to_df() to transform anndata in pandas DF #68

Merged
merged 1 commit into from
Oct 17, 2018
Merged

Method to_df() to transform anndata in pandas DF #68

merged 1 commit into from
Oct 17, 2018

Conversation

fbrundu
Copy link
Contributor

@fbrundu fbrundu commented Oct 8, 2018

It should implement the transformation only to a shallow dataframe (X, with obs_names and var_names as indexes).
It only bugs me that the dataframe returned has a slightly different precision than the one used to initialize the AnnData, eg:

> import pandas as pd
> import anndata as an
> df = pd.DataFrame(pd.np.random.rand(10,10), index=range(10), columns=range(10,20))
> df2 = an.AnnData(df, obs=df.index, var=df.columns).to_df()
> (df - df2).abs().max().max()
2.943521026921303e-08

It should implement the transformation only to a shallow dataframe (X, with obs_names and var_names as indexes)
@codecov
Copy link

codecov bot commented Oct 8, 2018

Codecov Report

Merging #68 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #68   +/-   ##
=======================================
  Coverage   65.33%   65.33%           
=======================================
  Files           9        9           
  Lines         727      727           
=======================================
  Hits          475      475           
  Misses        252      252

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 993d71b...bcdd003. Read the comment docs.

@falexwolf
Copy link
Member

Sorry for the super-late response. Thank you for this!

The precision is due to the fact, that dtype='float32' in the AnnData constructor. This is enough precision for anything I've seen in data science. If you set it to 'float64' you won't see this difference.

@falexwolf falexwolf merged commit 0a864db into scverse:master Oct 17, 2018
@fbrundu
Copy link
Contributor Author

fbrundu commented Oct 17, 2018

Sounds good, thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants