Skip to content

Fix merge() method to return MicroDataFrame - #261

Merged
MaxGhenis merged 12 commits into
masterfrom
fix-merge-method
Jul 24, 2025
Merged

Fix merge() method to return MicroDataFrame#261
MaxGhenis merged 12 commits into
masterfrom
fix-merge-method

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Jul 24, 2025

Copy link
Copy Markdown
Collaborator

Summary

This PR addresses multiple open issues by implementing missing functionality and fixing bugs in MicroDataFrame:

  • Implements merge() method that properly returns a MicroDataFrame
  • Adds drop() method with full inplace support
  • Adds __getattr__ method for intuitive column access
  • Adds nullify_weights() method to temporarily ignore weights
  • Fixes aggregation functions to skip non-numeric columns
  • Deprecates redundant set_weight_col() method

Changes

  1. Added drop() method: Required for merge operations, supports all pandas DataFrame.drop() parameters including inplace
  2. Added merge() method: Overrides pandas merge to return MicroDataFrame with preserved weights
  3. Added __getattr__ method: Allows accessing columns as attributes (e.g., df.column_name)
  4. Added nullify_weights() method: Sets all weights to 1 for both MicroDataFrame and MicroSeries
  5. Fixed aggregation functions: Now skip non-numeric columns instead of raising errors
  6. Deprecated set_weight_col(): Users should use set_weights(column_name) instead
  7. Added test coverage: For set_weights() with string column name argument

Issues Fixed

Test plan

  • Existing tests pass
  • Merge operations return MicroDataFrame instances
  • Drop operations work both with and without inplace=True
  • Weights are preserved correctly
  • Column access via dot notation works (e.g., df.column_name)
  • nullify_weights() sets all weights to 1
  • Aggregation functions skip non-numeric columns without errors
  • set_weights() works with both array and string arguments
  • Deprecation warning shown for set_weight_col()

🤖 Generated with Claude Code

MaxGhenis and others added 12 commits July 24, 2025 07:22
- Implement merge() method that returns MicroDataFrame instead of DataFrame
- Add drop() method with full inplace support
- Preserve weights correctly during merge operations
- Fixes issue where merge() would lose MicroDataFrame functionality

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Implement __getattr__ to allow df.column_name syntax (Fixes #220)
- Update changelog to reference all fixed issues
- This addresses user request for more intuitive column access

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Implement nullify_weights() to set all weights to 1 (Fixes #176)
- Useful for comparing weighted and unweighted statistics
- Method available on both MicroDataFrame and MicroSeries

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Update aggregation functions to skip non-numeric columns (Fixes #213)
- Matches pandas behavior which only aggregates numeric columns
- Applies to scalar, vector, and agnostic functions
- Also fixes groupby aggregations to skip non-numeric columns

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Add deprecation warning to set_weight_col() (Fixes #208)
- Add test for set_weights() with string column name argument
- set_weights() already handles both array and string inputs
- Users should use set_weights(column_name) instead of set_weight_col(column_name)

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Add missing _link_all_weights() call when weights is a string
- This ensures MicroSeries columns have their weights properly linked
- Fixes CI test failure

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Add comprehensive testing instructions to CLAUDE.md
- Include common CI failure troubleshooting guide
- Run formatter to fix docstring and import issues
- Ensure all files end with newlines

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Format microdataframe.py and test_microseries_dataframe.py with black
- Update CLAUDE.md to emphasize running `make format` before pushing
- This should fix CI linting failures

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Break long strings in deprecation warning and comment
- Ensure all lines are under 79 characters
- Now passes both `make format` and `make lint`

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Update Makefile so `make format` fails if there are long lines black can't fix
- This ensures CI lint checks and local development are in sync
- Developers must manually break long strings/comments
- Update CLAUDE.md to document this behavior

Now `make format` and CI lint checks are consistent - both will fail on E501 errors.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
@MaxGhenis
MaxGhenis merged commit 69fb974 into master Jul 24, 2025
8 checks passed
@nwoodruff-co
nwoodruff-co deleted the fix-merge-method branch December 18, 2025 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant