Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add merge type validation on pandas.merge
  • Loading branch information
KevsterAmp committed Aug 7, 2024
commit 8b22858a243384af6d39f992b00f5689762c104a
5 changes: 4 additions & 1 deletion pandas/core/reshape/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,10 @@ def merge(
left_df = _validate_operand(left)
left._check_copy_deprecation(copy)
right_df = _validate_operand(right)
if how == "cross":
merge_type = ["left", "right", "inner", "outer", "cross"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be in _MergeOperation.

And a test is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mroeschke - moved it to _MergeOperation and added asof as valid Merge Type.


Added test function to validate it as well. Thanks

if how not in merge_type:
raise ValueError(f"'{how}' is not a valid Merge type ({merge_type})")
elif how == "cross":
return _cross_merge(
left_df,
right_df,
Expand Down