Skip to content

Commit c1b9dc4

Browse files
committed
Update online docs
1 parent 1e7f874 commit c1b9dc4

File tree

1 file changed

+33
-1
lines changed
  • docs/source/user-guide/common-operations

1 file changed

+33
-1
lines changed

docs/source/user-guide/common-operations/joins.rst

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,36 @@ the right table.
101101

102102
.. ipython:: python
103103
104-
left.join(right, left_on="customer_id", right_on="id", how="anti")
104+
left.join(right, left_on="customer_id", right_on="id", how="anti")
105+
106+
Duplicate Keys
107+
--------------
108+
109+
It is common to join two DataFrames on a common column name. Starting in
110+
version 51.0.0, ``datafusion-python``` will now drop duplicate column names by
111+
default. This reduces problems with ambiguous column selection after joins.
112+
You can disable this feature by setting the parameter ``drop_duplicate_keys``
113+
to ``False``.
114+
115+
.. ipython:: python
116+
117+
left = ctx.from_pydict(
118+
{
119+
"id": [1, 2, 3],
120+
"customer": ["Alice", "Bob", "Charlie"],
121+
}
122+
)
123+
124+
right = ctx.from_pylist([
125+
{"id": 1, "name": "CityCabs"},
126+
{"id": 2, "name": "MetroRide"},
127+
{"id": 5, "name": "UrbanGo"},
128+
])
129+
130+
left.join(right, "id", how="inner")
131+
132+
In contrast to the above example, if we wish to get both columns:
133+
134+
.. ipython:: python
135+
136+
left.join(right, "id", "inner", drop_duplicate_keys=False)

0 commit comments

Comments
 (0)