{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Before you turn this problem in, make sure everything runs as expected. First, **restart the kernel** (in the menubar, select Kernel$\\rightarrow$Restart) and then **run all cells** (in the menubar, select Cell$\\rightarrow$Run All).\n", "\n", "Make sure you fill in any place that says `YOUR CODE HERE` or \"YOUR ANSWER HERE\", as well as your name and collaborators below:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "NAME = \"\"\n", "COLLABORATORS = \"\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "import os.path\n", "import pandas as pd\n", "\n", "datadir = \"publicdata\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "babybyname = pd.read_csv(os.path.join(datadir, \"babybyyear.csv\"))\n", "female1 = pd.read_csv(os.path.join(datadir, \"female1.csv\"))\n", "male1 = pd.read_csv(os.path.join(datadir, \"male1.csv\"))\n", "temps = pd.read_csv(os.path.join(datadir, \"madison_temp.csv\"))\n", "temps2 = pd.read_csv(os.path.join(datadir, \"temps2.csv\"))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "column_labels = ['I', 'J', '1', '2', '3']\n", "row_labels = ['A', 'B', 'C']\n", "dataset = [[ 'A.I', 'A.J', 'A.1', 'A.2', 'A.3' ],\n", " [ 'B.I', 'B.J', 'B.1', 'B.2', 'B.3' ],\n", " [ 'C.I', 'C.J', 'C.1', 'C.2', 'C.3' ]]\n", "example2 = pd.DataFrame(dataset, columns=column_labels, index=row_labels)\n", "example1 = example2.drop('J', axis=1)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "temps2" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "example1" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "example1.T" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "example1.T.T" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "example1.index = ['A', 'B', 'C']\n", "example1" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.3" } }, "nbformat": 4, "nbformat_minor": 4 }