@@ -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