Używamy techniczne pliki cookie i zanonimizowany dziennik wizyt Zorky. Yandex Metrica (dane są przechowywane na serwerach w Rosji) działa tylko za Twoją zgodą. Nigdy nie sprzedajemy danych. Więcej o cookies i statystykach.
Zorky działa w trybie testowym — wszystko jest bezpłatne. Oferty i strony firm są dostępne dla wszystkich; linki do ogłoszeń i osobiste zestawienie ofert — po rejestracji. Zarejestruj się →
← Wszystkie oferty

Data Analyst Interview Series: Part 31

Poziom nie podany1 dn. temu
Analityka rynku
📊 Data Engineering: wynagrodzenia i popyt na rynku
Stack
pandaspythonsql
Pokaż firmę i link
Bezpłatnie, po zalogowaniu.
Aplikuj
Odkryj firmę i link powyżej — Twoja aplikacja trafia prosto do systemu rekrutacyjnego firmy, bez pośredników.

Opis

🐍 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

Pełny opis, firma i link do aplikacji — po zalogowaniu. Zaloguj się
Kontakty pracodawcy (e-mail/telefon/Telegram) są ukryte w publicznym podglądzie.
Pilne pytanie? Napisz @termdocs