Usiamo cookie tecnici e il registro anonimo delle visite di Zorky. Yandex Metrica (dati conservati su server in Russia) funziona solo con il tuo consenso. Non vendiamo mai dati. Ulteriori informazioni su cookie e statistiche.
Zorky è in modalità test: è tutto gratuito. Le offerte e le pagine delle aziende sono aperte a tutti; i link agli annunci e la tua selezione personale si aprono dopo la registrazione. Registrati →
← Tutte le offerte

Data Analyst Interview Series: Part 31

Livello non indicato1 g fa
Analisi del mercato
📊 Data Engineering: stipendi e domanda sul mercato
Stack
pandaspythonsql
Mostra azienda e link
Gratis, dopo l'accesso.
Candidati
Apri l'azienda e il link qui sopra: la candidatura arriva direttamente nel sistema di selezione dell'azienda, senza intermediari.

Descrizione

🐍 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

Descrizione completa, azienda e link per candidarti: dopo l'accesso. Accedi
I contatti del datore di lavoro (email/telefono/telegram) sono nascosti nell'anteprima pubblica.
Domanda urgente? Scrivi a @termdocs