feat: add return_as parameter for pandas/pyarrow/anndata output#38
Open
timtreis wants to merge 4 commits into
Open
feat: add return_as parameter for pandas/pyarrow/anndata output#38timtreis wants to merge 4 commits into
timtreis wants to merge 4 commits into
Conversation
…ta output Add a `return_as` parameter to `featurize()` that supports four output formats: "tuple" (default, backward-compatible), "pandas" (DataFrame), "pyarrow" (Table with schema metadata), and "anndata" (AnnData with structured obs/var/uns). All three optional formats are lazy-imported to avoid hard dependencies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9ebae76 to
7d13002
Compare
- Use raw tuple check instead of DataFrame iloc for None vs NaN safety in _to_anndata - Add warning when 2D-only features are silently skipped on volumetric data - Remove redundant no-op ternary in meta_entries initialization - Remove unnecessary comment in _to_pyarrow Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
return_asparameter tofeaturize()supporting"tuple"(default),"pandas","pyarrow", and"anndata"output formatspip install cp_measure[pandas],cp_measure[anndata], etc.obs(image_id, object_type, label),var(feature_group, feature_type, feature_name, channel, channel_2),uns(config, channels, objects, is_3d)Files changed
src/cp_measure/featurizer.py—return_asparam,@overloadtype signatures, per-column metadata collectionsrc/cp_measure/_converters.py(new) — converter dispatch with lazy importspyproject.toml— optional dependency groupstest/test_return_as.py(new) — 31 tests covering all formats