Usamos cookies técnicas y el registro de visitas anonimizado de Zorky. Yandex Metrica (los datos se guardan en servidores en Rusia) solo se activa con tu consentimiento. Nunca vendemos datos. Más sobre cookies y estadísticas.
Zorky está en modo de prueba: todo es gratis. Los empleos y las páginas de empresas están abiertos a todos; los enlaces a las ofertas y tu selección personal se abren tras registrarte. Regístrate →
← Todos los empleos

Data Analyst Interview Series: Part 31

Nivel no indicadohace 3 d
Análisis del mercado
📊 Data Engineering: salarios y demanda en el mercado
Stack
pandaspythonsql
Mostrar empresa y enlace
Gratis, tras iniciar sesión.
Postular
Abre la empresa y el enlace de arriba: tu candidatura va directamente al sistema de selección de la empresa, sin intermediarios.

Descripción

🐍 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

Descripción completa, empresa y enlace para postular: después de iniciar sesión. Iniciar sesión
Los contactos del empleador (correo/teléfono/telegram) están ocultos en la vista previa pública.
¿Pregunta urgente? Escribe a @termdocs