-
Notifications
You must be signed in to change notification settings - Fork 1
feat: update SegTransactionStats to support multiple segment columns… #139
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
Conversation
- Modified SegTransactionStats to accept a list of columns for grouping
- Added backwards compatibility with string input for segment_col
- Updated total_metrics creation to handle multiple columns
- Added validation in plot method for multiple segment columns
- Added comprehensive unit tests for new functionality
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
WalkthroughThis PR adjusts the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances SegTransactionStats to support multiple segment columns while maintaining backwards compatibility for a string input. Key changes include:
- Allowing a list of segment columns in the constructor and internal methods.
- Updating the total metrics calculation and dataframe column ordering to accommodate multiple segment columns.
- Adding tests for handling multiple segment columns and ensuring the plot method raises an error when more than one segment is provided.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/analysis/test_segmentation.py | Added tests for multiple segment columns and plot validation behavior. |
| pyretailscience/analysis/segmentation.py | Modified SegTransactionStats to process a list of segment columns and update methods accordingly. |
Codecov ReportAttention: Patch coverage is
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
docs/examples/cross_shop.ipynb (1)
241-243: Consider clarifying or adjusting the distribution.
You're using a 50/50 split between "Shoes" and "Jeans," which might not always reflect real-world data. Consider documenting or parameterizing these probabilities if you need a more realistic or adjustable distribution.pyretailscience/plots/venn.py (1)
25-25: Add a quick data format example.Clarifying that the data must be pre-aggregated is helpful. Consider including a short example or reference in the docstring to show how users should structure their data before calling this module.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
.pre-commit-config.yaml(1 hunks)docs/examples/cross_shop.ipynb(1 hunks)docs/examples/gain_loss.ipynb(1 hunks)docs/examples/segmentation.ipynb(1 hunks)pyretailscience/analysis/cross_shop.py(0 hunks)pyretailscience/analysis/haversine.py(1 hunks)pyretailscience/plots/time.py(0 hunks)pyretailscience/plots/venn.py(1 hunks)
💤 Files with no reviewable changes (2)
- pyretailscience/analysis/cross_shop.py
- pyretailscience/plots/time.py
✅ Files skipped from review due to trivial changes (1)
- pyretailscience/analysis/haversine.py
🚧 Files skipped from review as they are similar to previous changes (1)
- .pre-commit-config.yaml
👮 Files not reviewed due to content moderation or server errors (2)
- docs/examples/gain_loss.ipynb
- docs/examples/segmentation.ipynb
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores
rufftool.