Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Outer Join | Joining Data
Data Manipulation using pandas

bookOuter Join

Let's learn the last type of join - outer join. As you remember, left join keeps all the records from the left table, inner join keeps only records with matching values for both tables. Outer join performs almost an opposite action compared to inner join - it keeps all the records from both tables, and adds data if there are matches.

For instance, we can perform an outer join of the same two tables we used before.

12345678910
# Importing library import pandas as pd # Loading data data1 = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/f2947b09-5f0d-4ad9-992f-ec0b87cd4b3f/section5/data1.csv') data2 = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/f2947b09-5f0d-4ad9-992f-ec0b87cd4b3f/section5/data2.csv') # Perform a left join df_res = data1.merge(data2, on = 'id', how = 'outer') print(df_res)
copy

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 5. Capítulo 5

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

Awesome!

Completion rate improved to 2.56

bookOuter Join

Desliza para mostrar el menú

Let's learn the last type of join - outer join. As you remember, left join keeps all the records from the left table, inner join keeps only records with matching values for both tables. Outer join performs almost an opposite action compared to inner join - it keeps all the records from both tables, and adds data if there are matches.

For instance, we can perform an outer join of the same two tables we used before.

12345678910
# Importing library import pandas as pd # Loading data data1 = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/f2947b09-5f0d-4ad9-992f-ec0b87cd4b3f/section5/data1.csv') data2 = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/f2947b09-5f0d-4ad9-992f-ec0b87cd4b3f/section5/data2.csv') # Perform a left join df_res = data1.merge(data2, on = 'id', how = 'outer') print(df_res)
copy

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 5. Capítulo 5
some-alt