{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# pandas 100제 실습 노트북\n",
    "\n",
    "위퀴즈 북스 「pandas 100제: 판다스 연습문제와 풀이」의 실습용 노트북입니다.\n",
    "\n",
    "1. 장마다 **준비 코드** 셀을 먼저 실행하세요 (Shift+Enter).\n",
    "2. 문제 아래 빈 셀에 코드를 써서 실행합니다. 같은 장의 문제는 번호 순서대로 이어집니다.\n",
    "3. 막히면 책의 힌트와 정답을 펼쳐 보세요: https://wequiz.org/books/pandas-100-exercises/\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 081–090 합치기와 모양 바꾸기\n",
    "\n",
    "해설·힌트·정답: https://wequiz.org/books/pandas-100-exercises/pandas-100-081-merge-reshape/"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**준비 코드** — 이 셀을 먼저 실행하세요."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "students = pd.DataFrame({'name': ['김민준', '이서연', '박지호', '최수아'],\n",
    "                         'class': ['A', 'B', 'A', 'C']})\n",
    "clubs = pd.DataFrame({'name': ['김민준', '박지호', '정민서'],\n",
    "                      'club': ['축구', '밴드', '독서']})\n",
    "scores = pd.DataFrame({'student': ['김민준', '이서연', '박지호', '최수아'],\n",
    "                       'kor': [85, 92, 58, 77], 'eng': [78, 88, 64, 95]})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 081. 공통 열로 합치기\n",
    "\n",
    "`students`와 `clubs`를 `name`으로 합치세요(양쪽에 있는 학생만)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 여기에 코드를 쓰고 Shift+Enter\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 082. 왼쪽 기준 합치기\n",
    "\n",
    "모든 학생을 남기고 동아리 정보를 붙이세요."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 여기에 코드를 쓰고 Shift+Enter\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 083. 열 이름이 다를 때\n",
    "\n",
    "`students`의 `name`과 `scores`의 `student`를 기준으로 합치세요."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 여기에 코드를 쓰고 Shift+Enter\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 084. 어느 쪽에 있었는지\n",
    "\n",
    "양쪽 모든 행을 남기고, 행이 어디서 왔는지 표시하세요."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 여기에 코드를 쓰고 Shift+Enter\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 085. 아래로 이어 붙이기\n",
    "\n",
    "`students` 아래에 새 학생 한 명(이름 `정민서`, 반 `B`)을 붙이고, 인덱스를 0부터 다시 매기세요."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 여기에 코드를 쓰고 Shift+Enter\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 086. 옆으로 이어 붙이기\n",
    "\n",
    "`students`와 `scores`의 `kor`, `eng`를 옆으로 붙이세요(행 순서가 같다고 가정)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 여기에 코드를 쓰고 Shift+Enter\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 087. 넓은 표를 길게\n",
    "\n",
    "`scores`를 `student`, `subject`, `score` 세 열의 긴 표로 바꾸세요."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 여기에 코드를 쓰고 Shift+Enter\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 088. 긴 표를 넓게\n",
    "\n",
    "87번의 긴 표를 다시 학생별 과목 열로 펼치세요."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 여기에 코드를 쓰고 Shift+Enter\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 089. 교차표\n",
    "\n",
    "모든 학생에게 동아리 정보를 붙인 뒤(왼쪽 결합), 반(행) × 동아리 가입 여부(열: `가입`/`미가입`)별 학생 수를 교차표로 구하세요."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 여기에 코드를 쓰고 Shift+Enter\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 090. 리스트를 행으로 펼치기\n",
    "\n",
    "다음 표의 `tags` 열에는 리스트가 들어 있습니다. 태그 하나가 한 행이 되도록 펼치세요.\n",
    "\n",
    "```python\n",
    "t = pd.DataFrame({'post': [1, 2], 'tags': [['pandas', 'python'], ['sql']]})\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 여기에 코드를 쓰고 Shift+Enter\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
