{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 1\n", "Import NumPy under the alias `np`." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 2\n", "Import pandas under the alias `pd`." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 3\n", "Using `df1` and `df2` as specified below, merge them using the key `key`. Specify `how = inner` as an argument." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "df1 = pd.DataFrame({'key': ['foo', 'bar', 'baz', 'foo'],\n", " 'value': [1, 2, 3, 5]})\n", "df2 = pd.DataFrame({'key': ['foo', 'bar', 'baz', 'foo'],\n", " 'value': [5, 6, 7, 8]})" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | key | \n", "value_x | \n", "value_y | \n", "
|---|---|---|---|
| 0 | \n", "foo | \n", "1 | \n", "5 | \n", "
| 1 | \n", "foo | \n", "1 | \n", "8 | \n", "
| 2 | \n", "foo | \n", "5 | \n", "5 | \n", "
| 3 | \n", "foo | \n", "5 | \n", "8 | \n", "
| 4 | \n", "bar | \n", "2 | \n", "6 | \n", "
| 5 | \n", "baz | \n", "3 | \n", "7 | \n", "