Wir verwenden technische Cookies und das anonymisierte Besuchsprotokoll von Zorky. Yandex Metrica (Daten werden auf Servern in Russland gespeichert) läuft nur mit Ihrer Einwilligung. Wir verkaufen keine Daten. Mehr zu Cookies und Statistik.
Zorky läuft im Testmodus — alles ist kostenlos. Stellen und Unternehmensseiten sind für alle offen; Links zu den Anzeigen und Ihre persönliche Stellenauswahl gibt es nach der Registrierung. Registrieren →
← Alle Stellen

Data Analyst Interview Series: Part 31

Level nicht angegebenvor 1 T.
Markteinblicke
📊 Data Engineering: Gehälter und Nachfrage am Markt
Stack
pandaspythonsql
Unternehmen und Link anzeigen
Kostenlos, nach der Anmeldung.
Bewerben
Öffnen Sie oben das Unternehmen und den Link — Ihre Bewerbung geht direkt in das Recruiting-System des Unternehmens, ohne Vermittler.

Beschreibung

🐍 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

Vollständige Beschreibung, Unternehmen und Bewerbungslink — nach der Anmeldung. Anmelden
Kontaktdaten des Arbeitgebers (E-Mail/Telefon/Telegram) sind in der öffentlichen Vorschau ausgeblendet.
Dringende Frage? Schreiben Sie @termdocs