pandas/merge-without-on
| Rule | merge-without-on |
|---|---|
| Pack | pandas |
| Severity | warning |
| Fix | none, edit by hand |
| Library versions | every version |
Without on=, merge joins on every column name the two frames share, so a new shared column silently changes the join. Name the keys with on=.
joined = left.merge(right, validate="many_to_one")joined = left.merge(right, on="key", validate="many_to_one")What the rule reports
Section titled “What the rule reports”The rule reports merge without on=, which joins on every shared column name.
How to fix it
Section titled “How to fix it”xpd has no automatic fix, so make the change by hand.
Name the key columns that you mean to join on.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
Without on=, merge joins on every column name the two frames share, so a new shared column changes the join. Name the keys with on=.Browse the other rules of the pandas pack.