SOMA-component dataframe/schema accessors #104
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
These are schema-introspection accessors. In an upcoming PR, we'll have an
examples/
directory, along with some vignette-style documentation.Notes
pandas.DataFrame
etc. There is, however, afoo.tiledb_array_schema()
methodsoma.X.data
andsoma.raw.X.data
. In a future PR these will besoma.X["data"]
andsoma.raw.X["data"]
along with an add-layer functionality.soma.foo.df().keys() and
some.foo.df().dtypes` -- loads a dataframe and returns pandas/numpy typessoma.foo.df(["nonesuch"]).dtypes
to get a "no such answer" query but this is a little clumsy -- maybe I can hide within a methodTileDB-Py
engine returns a Pandas dataframe, and we simply ask the Pandas dataframe what its types are.soma.foo.tiledb_array_schema()
soma.foo.dim_names_to_types()
andsoma.foo.attr_names_to_types()
-- these load the tiledb array schema (without loading the df) & then walk through that & pull out types in a storage-independent way.Examples:
soma.obs
Loaded dataframe:
soma.var
Loaded dataframe:
soma.X.data
Loaded dataframe:
soma.obsm
Loaded dataframe: