Мы используем технические cookie и обезличенный журнал посещений Zorky. Яндекс Метрику (данные хранятся на серверах в РФ) включаем только с вашего согласия. Данные не продаём. Подробнее о cookie и статистике.
Zorky в тестовом режиме — всё бесплатно. Вакансии и страницы компаний открыты всем; ссылки на объявления и личная подборка — после регистрации. Зарегистрироваться →
ZorkyZorky

Поиск по сайту

Введите название — например, Python, Airalo или Берлин
    Место
    Где ищете работу?
    Русский
    ← Все вакансии

    Data Analyst Interview Series: Part 31

    Уровень не указан1нед назад
    Аналитика рынка
    📊 Data Engineer: зарплаты и спрос на рынке
    Стек
    pandaspythonsql
    Показать компанию и ссылку
    Бесплатно, после входа в кабинет.
    Откликнуться
    Откройте компанию и ссылку выше — отклик уходит прямо в систему найма компании, без посредников.

    Описание

    🐍 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

    Полное описание, компания и ссылка на вакансию — после входа. Войти
    Контакты работодателя (email/phone/telegram) скрыты из публичного превью.
    Срочный вопрос? Напишите @termdocs