Usamos cookies técnicos e o registro de visitas anonimizado do Zorky. O Yandex Metrica (dados armazenados em servidores na Rússia) só funciona com o seu consentimento. Nunca vendemos dados. Mais sobre cookies e estatísticas.
O Zorky está em modo de teste — tudo é gratuito. As vagas e as páginas das empresas são abertas a todos; os links dos anúncios e sua seleção pessoal abrem após o cadastro. Cadastre-se →
← Todas as vagas

Data Analyst Interview Series: Part 31

Nível não informadohá 3 d
Análises de mercado
📊 Data Engineering: salários e demanda no mercado
Stack
pandaspythonsql
Mostrar empresa e link
Grátis, depois de entrar.
Candidatar-se
Abra a empresa e o link acima — sua candidatura vai direto para o sistema de recrutamento da empresa, sem intermediários.

Descrição

🐍 Data Analyst Interview Series: Part 31

Guys, let's continue our Python Interview Series.

In the previous part, we covered Pandas GroupBy and Aggregation. Today, let's focus on combining datasets and reshaping data using Pandas.

Part 31, Pandas Merge, Join, Concat & Pivot Tables

1️⃣ What is the difference between merge() and concat() in Pandas?

Sample Answer:

Both functions combine DataFrames, but they work differently.

merge() combines DataFrames based on common columns or indexes, similar to SQL JOIN operations.

Example:

import pandas as pd

  • df1 = pd.DataFrame({
  • "CustomerID": [1, 2, 3],
  • "Name": ["Rahul", "Priya", "Amit"]
  • })
  • df2 = pd.DataFrame({
  • "CustomerID": [1, 2, 3],
  • "Sales": [5000, 7000, 6000]
  • })

result = pd.merge(df1, df2, on="CustomerID")

concat() combines DataFrames along rows or columns.

result = pd.concat([df1, df2], axis=0)

In simple terms:

Merge → Combine based on matching keys.

Concat → Stack DataFrames along rows or columns.

2️⃣ What are the different types of joins in Pandas?

Pandas supports different types of joins through the merge() function.

  • Inner Join, Returns matching records from both DataFrames.
  • Left Join, Returns all records from the left DataFrame and matching records from the right.
  • Right Join, Returns all records from the right DataFrame and matching records from the left.
  • Outer Join, Returns all records from both DataFrames.
  • result = pd.merge(
  • df1,
  • df2,
  • on="CustomerID",
  • how="left"
  • )

T

Descrição completa, empresa e link para se candidatar: depois de entrar. Entrar
Os contatos do empregador (e-mail/telefone/telegram) ficam ocultos na prévia pública.
Pergunta urgente? Escreva para @termdocs