Skip to content

Commit aa20c8a

Browse files
authored
Add warning about NA merges (#42865)
1 parent 405fbc4 commit aa20c8a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

doc/source/getting_started/comparison/comparison_with_sql.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ default, :meth:`~pandas.DataFrame.join` will join the DataFrames on their indice
233233
parameters allowing you to specify the type of join to perform (``LEFT``, ``RIGHT``, ``INNER``,
234234
``FULL``) or the columns to join on (column names or indices).
235235

236+
.. warning::
237+
238+
If both key columns contain rows where the key is a null value, those
239+
rows will be matched against each other. This is different from usual SQL
240+
join behaviour and can lead to unexpected results.
241+
236242
.. ipython:: python
237243
238244
df1 = pd.DataFrame({"key": ["A", "B", "C", "D"], "value": np.random.randn(4)})

pandas/core/frame.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,12 @@
265265
When performing a cross merge, no column specifications to merge on are
266266
allowed.
267267
268+
.. warning::
269+
270+
If both key columns contain rows where the key is a null value, those
271+
rows will be matched against each other. This is different from usual SQL
272+
join behaviour and can lead to unexpected results.
273+
268274
Parameters
269275
----------%s
270276
right : DataFrame or named Series

0 commit comments

Comments
 (0)