Использование соединения в Python ⇐ Python
-
Anonymous
Использование соединения в Python
I am converting an SQL code, that has a join function, to Python.
This is the SQL code:
INSERT INTO tropical_fruits SELECT DISTINCT A.* FROM fruits A LEFT OUTER JOIN tropical_fruits B ON A.[fruit1] = B.[fruit1] AND A.[fruit2] = B.[fruit2]; Python conversion code is:
data = pd.merge( fruits, tropical_fruits, left_on=['fruit1','fruit2'], right_on=['fruit1','fruit2'], how='left' ) But I haven't got the desired result. Is the Python code correct?
Источник: https://stackoverflow.com/questions/780 ... -in-python
I am converting an SQL code, that has a join function, to Python.
This is the SQL code:
INSERT INTO tropical_fruits SELECT DISTINCT A.* FROM fruits A LEFT OUTER JOIN tropical_fruits B ON A.[fruit1] = B.[fruit1] AND A.[fruit2] = B.[fruit2]; Python conversion code is:
data = pd.merge( fruits, tropical_fruits, left_on=['fruit1','fruit2'], right_on=['fruit1','fruit2'], how='left' ) But I haven't got the desired result. Is the Python code correct?
Источник: https://stackoverflow.com/questions/780 ... -in-python