Skip to content

Instantly share code, notes, and snippets.

@ischurov
Created March 7, 2022 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ischurov/f520e2796e364c2c307be5ce42069311 to your computer and use it in GitHub Desktop.
Save ischurov/f520e2796e364c2c307be5ce42069311 to your computer and use it in GitHub Desktop.
Lesson13
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {},
"cell_type": "markdown",
"source": "## Наука о данных\n### Совместный бакалавриат ВШЭ-РЭШ, 2021-2022 учебный год\n_Илья Щуров_\n\n[Страница курса](http://math-info.hse.ru/s21/j)"
},
{
"metadata": {
"trusted": false
},
"id": "primary-sensitivity",
"cell_type": "code",
"source": "import pandas as pd",
"execution_count": 1,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "bulgarian-adoption",
"cell_type": "code",
"source": "ser = pd.Series([10, 20, 30, 15])",
"execution_count": 2,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "understanding-grounds",
"cell_type": "code",
"source": "ser",
"execution_count": 3,
"outputs": [
{
"data": {
"text/plain": "0 10\n1 20\n2 30\n3 15\ndtype: int64"
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "collective-faculty",
"cell_type": "code",
"source": "ser[0] = 100",
"execution_count": 4,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "seasonal-reggae",
"cell_type": "code",
"source": "ser",
"execution_count": 5,
"outputs": [
{
"data": {
"text/plain": "0 100\n1 20\n2 30\n3 15\ndtype: int64"
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "interpreted-controversy",
"cell_type": "code",
"source": "ser[2]",
"execution_count": 6,
"outputs": [
{
"data": {
"text/plain": "30"
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "analyzed-suspect",
"cell_type": "code",
"source": "ser + 2",
"execution_count": 7,
"outputs": [
{
"data": {
"text/plain": "0 102\n1 22\n2 32\n3 17\ndtype: int64"
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "behavioral-claim",
"cell_type": "code",
"source": "ser.values",
"execution_count": 8,
"outputs": [
{
"data": {
"text/plain": "array([100, 20, 30, 15])"
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "incomplete-station",
"cell_type": "code",
"source": "ser",
"execution_count": 9,
"outputs": [
{
"data": {
"text/plain": "0 100\n1 20\n2 30\n3 15\ndtype: int64"
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "distinct-panel",
"cell_type": "code",
"source": "grades = pd.Series([4, 5, 3], index=['Alice', 'Bob', 'Claudia'])",
"execution_count": 10,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "powered-sunrise",
"cell_type": "code",
"source": "grades",
"execution_count": 11,
"outputs": [
{
"data": {
"text/plain": "Alice 4\nBob 5\nClaudia 3\ndtype: int64"
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "northern-venue",
"cell_type": "code",
"source": "grades['Alice']",
"execution_count": 12,
"outputs": [
{
"data": {
"text/plain": "4"
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "fancy-christian",
"cell_type": "code",
"source": "grades[0]",
"execution_count": 13,
"outputs": [
{
"data": {
"text/plain": "4"
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "inclusive-cowboy",
"cell_type": "code",
"source": "grades[1]",
"execution_count": 14,
"outputs": [
{
"data": {
"text/plain": "5"
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "floppy-mirror",
"cell_type": "code",
"source": "grades[2]",
"execution_count": 15,
"outputs": [
{
"data": {
"text/plain": "3"
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "authentic-billy",
"cell_type": "code",
"source": "math_grades = pd.Series([4, 5, 3], index=['Alice', 'Bob', 'Claudia'])\nenglish_grades = pd.Series([1, 4, 3, 5], index=['Bob', 'Alice', 'Elizabeth', 'Claudia'])",
"execution_count": 24,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "median-pharmaceutical",
"cell_type": "code",
"source": "math_grades",
"execution_count": 25,
"outputs": [
{
"data": {
"text/plain": "Alice 4\nBob 5\nClaudia 3\ndtype: int64"
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "compressed-thailand",
"cell_type": "code",
"source": "english_grades",
"execution_count": 26,
"outputs": [
{
"data": {
"text/plain": "Bob 1\nAlice 4\nElizabeth 3\nClaudia 5\ndtype: int64"
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "accessible-population",
"cell_type": "code",
"source": "sum_grades = math_grades + english_grades",
"execution_count": 29,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "composite-pattern",
"cell_type": "code",
"source": "float(\"NaN\")",
"execution_count": 28,
"outputs": [
{
"data": {
"text/plain": "nan"
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "accepted-target",
"cell_type": "code",
"source": "sum_grades['Elizabeth']",
"execution_count": 32,
"outputs": [
{
"data": {
"text/plain": "nan"
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "handed-rally",
"cell_type": "code",
"source": "if sum_grades['Elizabeth'] == float(\"NaN\"):\n print(\"Elizabeth's grade unknown\")",
"execution_count": 33,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "wound-template",
"cell_type": "code",
"source": "float(\"NaN\") == float(\"NaN\")",
"execution_count": 34,
"outputs": [
{
"data": {
"text/plain": "False"
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "sunset-racing",
"cell_type": "code",
"source": "x = float(\"NaN\")",
"execution_count": 35,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "dominican-monday",
"cell_type": "code",
"source": "x == x",
"execution_count": 36,
"outputs": [
{
"data": {
"text/plain": "False"
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "proprietary-motorcycle",
"cell_type": "code",
"source": "float(\"inf\") == float(\"inf\")",
"execution_count": 38,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "killing-algebra",
"cell_type": "code",
"source": "pd.isna(sum_grades['Elizabeth'])",
"execution_count": 39,
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "afraid-trainer",
"cell_type": "code",
"source": "ser",
"execution_count": 40,
"outputs": [
{
"data": {
"text/plain": "0 100\n1 20\n2 30\n3 15\ndtype: int64"
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "narrative-conflict",
"cell_type": "code",
"source": "grades",
"execution_count": 41,
"outputs": [
{
"data": {
"text/plain": "Alice 4\nBob 5\nClaudia 3\ndtype: int64"
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "meaningful-stevens",
"cell_type": "code",
"source": "grades[1]",
"execution_count": 42,
"outputs": [
{
"data": {
"text/plain": "5"
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "attempted-switzerland",
"cell_type": "code",
"source": "grades['Alice']",
"execution_count": 43,
"outputs": [
{
"data": {
"text/plain": "4"
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "hawaiian-pioneer",
"cell_type": "code",
"source": "squares = pd.Series([4, 9, 16], index=[2, 3, 4])",
"execution_count": 44,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "reliable-spice",
"cell_type": "code",
"source": "squares",
"execution_count": 45,
"outputs": [
{
"data": {
"text/plain": "2 4\n3 9\n4 16\ndtype: int64"
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "blond-liability",
"cell_type": "code",
"source": "squares[2]",
"execution_count": 46,
"outputs": [
{
"data": {
"text/plain": "4"
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "dramatic-format",
"cell_type": "code",
"source": "squares.iloc[2]",
"execution_count": 47,
"outputs": [
{
"data": {
"text/plain": "16"
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "transparent-million",
"cell_type": "code",
"source": "squares.loc[2]",
"execution_count": 48,
"outputs": [
{
"data": {
"text/plain": "4"
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "integrated-strength",
"cell_type": "code",
"source": "grades = pd.Series({'Alice': 3, 'Bob': 2, 'Claudia': 3, 'Elizabeth': 4})",
"execution_count": 50,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "opposed-beach",
"cell_type": "code",
"source": "grades",
"execution_count": 53,
"outputs": [
{
"data": {
"text/plain": "Alice 3\nBob 2\nClaudia 3\nElizabeth 4\ndtype: int64"
},
"execution_count": 53,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "tight-cincinnati",
"cell_type": "code",
"source": "grades['Bob':'Elizabeth']",
"execution_count": 52,
"outputs": [
{
"data": {
"text/plain": "Bob 2\nClaudia 3\nElizabeth 4\ndtype: int64"
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "academic-retirement",
"cell_type": "code",
"source": "grades[1:3]",
"execution_count": 54,
"outputs": [
{
"data": {
"text/plain": "Bob 2\nClaudia 3\ndtype: int64"
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "featured-music",
"cell_type": "code",
"source": "grades['Bob':'Cz']",
"execution_count": 58,
"outputs": [
{
"data": {
"text/plain": "Bob 2\nClaudia 3\ndtype: int64"
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "subject-tower",
"cell_type": "code",
"source": "grades = pd.Series({'Alice': 3, 'Claudia': 3, 'Bob': 2, 'Elizabeth': 4})",
"execution_count": 59,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "adjustable-technician",
"cell_type": "code",
"source": "grades['Claudia':'Elizabeth']",
"execution_count": 60,
"outputs": [
{
"data": {
"text/plain": "Claudia 3\nBob 2\nElizabeth 4\ndtype: int64"
},
"execution_count": 60,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "assigned-attendance",
"cell_type": "code",
"source": "grades['Claudia':'Emma']",
"execution_count": 61,
"outputs": [
{
"ename": "KeyError",
"evalue": "'Emma'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36mget_loc\u001b[0;34m(self, key, method, tolerance)\u001b[0m\n\u001b[1;32m 3360\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3361\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcasted_key\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3362\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0merr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/_libs/index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[0;34m()\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/_libs/index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[0;34m()\u001b[0m\n",
"\u001b[0;32mpandas/_libs/hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[0;34m()\u001b[0m\n",
"\u001b[0;32mpandas/_libs/hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[0;34m()\u001b[0m\n",
"\u001b[0;31mKeyError\u001b[0m: 'Emma'",
"\nThe above exception was the direct cause of the following exception:\n",
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/var/folders/h2/9nyrt4p55kq6pdvqg02_zmj40000gn/T/ipykernel_41718/634641822.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mgrades\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Claudia'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m'Emma'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/series.py\u001b[0m in \u001b[0;36m__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 964\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_values\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 965\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 966\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_with\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 967\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 968\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_get_with\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/series.py\u001b[0m in \u001b[0;36m_get_with\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 971\u001b[0m \u001b[0;31m# _convert_slice_indexer to determine if this slice is positional\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 972\u001b[0m \u001b[0;31m# or label based, and if the latter, convert to positional\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 973\u001b[0;31m \u001b[0mslobj\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_convert_slice_indexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkind\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"getitem\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 974\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_slice\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mslobj\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 975\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mABCDataFrame\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36m_convert_slice_indexer\u001b[0;34m(self, key, kind)\u001b[0m\n\u001b[1;32m 3751\u001b[0m \u001b[0mindexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3752\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3753\u001b[0;31m \u001b[0mindexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mslice_indexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstart\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstop\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstep\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3754\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3755\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mindexer\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36mslice_indexer\u001b[0;34m(self, start, end, step, kind)\u001b[0m\n\u001b[1;32m 5683\u001b[0m \u001b[0mslice\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5684\u001b[0m \"\"\"\n\u001b[0;32m-> 5685\u001b[0;31m \u001b[0mstart_slice\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mend_slice\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mslice_locs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstart\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mend\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstep\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstep\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5686\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5687\u001b[0m \u001b[0;31m# return a slice\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36mslice_locs\u001b[0;34m(self, start, end, step, kind)\u001b[0m\n\u001b[1;32m 5891\u001b[0m \u001b[0mend_slice\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5892\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mend\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 5893\u001b[0;31m \u001b[0mend_slice\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_slice_bound\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mend\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"right\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5894\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mend_slice\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5895\u001b[0m \u001b[0mend_slice\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36mget_slice_bound\u001b[0;34m(self, label, side, kind)\u001b[0m\n\u001b[1;32m 5805\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5806\u001b[0m \u001b[0;31m# raise the original KeyError\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 5807\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0merr\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5808\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5809\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mslc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mndarray\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36mget_slice_bound\u001b[0;34m(self, label, side, kind)\u001b[0m\n\u001b[1;32m 5799\u001b[0m \u001b[0;31m# we need to look up the label\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5800\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 5801\u001b[0;31m \u001b[0mslc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlabel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5802\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0merr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5803\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36mget_loc\u001b[0;34m(self, key, method, tolerance)\u001b[0m\n\u001b[1;32m 3361\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcasted_key\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3362\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0merr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0merr\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mis_scalar\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0misna\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhasnans\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mKeyError\u001b[0m: 'Emma'"
]
}
]
},
{
"metadata": {
"trusted": false
},
"id": "beneficial-reviewer",
"cell_type": "code",
"source": "grades",
"execution_count": 79,
"outputs": [
{
"data": {
"text/plain": "Alice 3\nBob 2\nClaudia 3\nElizabeth 4\ndtype: int64"
},
"execution_count": 79,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "complimentary-court",
"cell_type": "code",
"source": "grades[1:3]",
"execution_count": 66,
"outputs": [
{
"data": {
"text/plain": "Claudia 3\nBob 2\ndtype: int64"
},
"execution_count": 66,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "vulnerable-sleeping",
"cell_type": "code",
"source": "grades.sort_index(inplace=True)",
"execution_count": 70,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "sharp-commonwealth",
"cell_type": "code",
"source": "grades",
"execution_count": 71,
"outputs": [
{
"data": {
"text/plain": "Alice 3\nBob 2\nClaudia 3\nElizabeth 4\ndtype: int64"
},
"execution_count": 71,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "incomplete-young",
"cell_type": "code",
"source": "grades.sort_values()",
"execution_count": 72,
"outputs": [
{
"data": {
"text/plain": "Bob 2\nAlice 3\nClaudia 3\nElizabeth 4\ndtype: int64"
},
"execution_count": 72,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "concrete-hollywood",
"cell_type": "code",
"source": "squares",
"execution_count": 73,
"outputs": [
{
"data": {
"text/plain": "2 4\n3 9\n4 16\ndtype: int64"
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "transparent-salad",
"cell_type": "code",
"source": "squares[2]",
"execution_count": 74,
"outputs": [
{
"data": {
"text/plain": "4"
},
"execution_count": 74,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "several-reply",
"cell_type": "code",
"source": "squares[2:4]",
"execution_count": 75,
"outputs": [
{
"data": {
"text/plain": "4 16\ndtype: int64"
},
"execution_count": 75,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "satellite-community",
"cell_type": "code",
"source": "squares[1:2]",
"execution_count": 76,
"outputs": [
{
"data": {
"text/plain": "3 9\ndtype: int64"
},
"execution_count": 76,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "indie-saver",
"cell_type": "code",
"source": "squares[2:7]",
"execution_count": 78,
"outputs": [
{
"data": {
"text/plain": "4 16\ndtype: int64"
},
"execution_count": 78,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "innocent-category",
"cell_type": "code",
"source": "squares.iloc[1:3]",
"execution_count": 90,
"outputs": [
{
"data": {
"text/plain": "3 9\n4 16\ndtype: int64"
},
"execution_count": 90,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "fifteen-label",
"cell_type": "code",
"source": "squares.loc[1:3]",
"execution_count": 88,
"outputs": [
{
"data": {
"text/plain": "2 4\n3 9\ndtype: int64"
},
"execution_count": 88,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "basic-adoption",
"cell_type": "code",
"source": "squares",
"execution_count": 91,
"outputs": [
{
"data": {
"text/plain": "2 4\n3 9\n4 16\ndtype: int64"
},
"execution_count": 91,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "hourly-while",
"cell_type": "code",
"source": "squares ** 1000",
"execution_count": 96,
"outputs": [
{
"data": {
"text/plain": "2 0\n3 -5722699974397887935\n4 0\ndtype: int64"
},
"execution_count": 96,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "ceramic-boost",
"cell_type": "code",
"source": "pd.Series([2 ** 10])",
"execution_count": 100,
"outputs": [
{
"data": {
"text/plain": "0 1024\ndtype: int64"
},
"execution_count": 100,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "economic-failure",
"cell_type": "code",
"source": "pd.Series([2.]) ** 10000",
"execution_count": 104,
"outputs": [
{
"data": {
"text/plain": "0 inf\ndtype: float64"
},
"execution_count": 104,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "adapted-defensive",
"cell_type": "code",
"source": "df = pd.DataFrame([[1, 2, 3],\n [4, 5, 6]])",
"execution_count": 105,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "unavailable-summit",
"cell_type": "code",
"source": "df",
"execution_count": 106,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>0</th>\n <th>1</th>\n <th>2</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n </tr>\n <tr>\n <th>1</th>\n <td>4</td>\n <td>5</td>\n <td>6</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " 0 1 2\n0 1 2 3\n1 4 5 6"
},
"execution_count": 106,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "infinite-flood",
"cell_type": "code",
"source": "df[0]",
"execution_count": 107,
"outputs": [
{
"data": {
"text/plain": "0 1\n1 4\nName: 0, dtype: int64"
},
"execution_count": 107,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "varying-knock",
"cell_type": "code",
"source": "df.iloc[0, :]",
"execution_count": 110,
"outputs": [
{
"data": {
"text/plain": "0 1\n1 2\n2 3\nName: 0, dtype: int64"
},
"execution_count": 110,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "posted-devil",
"cell_type": "code",
"source": "df = pd.DataFrame([['Alice', 1, 2, 3],\n ['Bob', 4, 5, 6]], columns=['name', 'calculus', 'algebra', 'geometry'])",
"execution_count": 111,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "yellow-patrick",
"cell_type": "code",
"source": "df",
"execution_count": 112,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>name</th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>Alice</td>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n </tr>\n <tr>\n <th>1</th>\n <td>Bob</td>\n <td>4</td>\n <td>5</td>\n <td>6</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " name calculus algebra geometry\n0 Alice 1 2 3\n1 Bob 4 5 6"
},
"execution_count": 112,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "automated-market",
"cell_type": "code",
"source": "df['name']",
"execution_count": 113,
"outputs": [
{
"data": {
"text/plain": "0 Alice\n1 Bob\nName: name, dtype: object"
},
"execution_count": 113,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "palestinian-receiver",
"cell_type": "code",
"source": "df['calculus']",
"execution_count": 114,
"outputs": [
{
"data": {
"text/plain": "0 1\n1 4\nName: calculus, dtype: int64"
},
"execution_count": 114,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "coordinated-rendering",
"cell_type": "code",
"source": "df.loc[0]",
"execution_count": 115,
"outputs": [
{
"data": {
"text/plain": "name Alice\ncalculus 1\nalgebra 2\ngeometry 3\nName: 0, dtype: object"
},
"execution_count": 115,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "fabulous-witch",
"cell_type": "code",
"source": "df.loc[1, 'calculus']",
"execution_count": 116,
"outputs": [
{
"data": {
"text/plain": "4"
},
"execution_count": 116,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "small-freeze",
"cell_type": "code",
"source": "df.loc[:, 'calculus']",
"execution_count": 117,
"outputs": [
{
"data": {
"text/plain": "0 1\n1 4\nName: calculus, dtype: int64"
},
"execution_count": 117,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "specified-skating",
"cell_type": "code",
"source": "df.iloc[1, 3]",
"execution_count": 118,
"outputs": [
{
"data": {
"text/plain": "6"
},
"execution_count": 118,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "operational-binding",
"cell_type": "code",
"source": "df",
"execution_count": 119,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>name</th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>Alice</td>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n </tr>\n <tr>\n <th>1</th>\n <td>Bob</td>\n <td>4</td>\n <td>5</td>\n <td>6</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " name calculus algebra geometry\n0 Alice 1 2 3\n1 Bob 4 5 6"
},
"execution_count": 119,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "equal-knight",
"cell_type": "code",
"source": "df.iloc[1, 3] = 4",
"execution_count": 120,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "yellow-terminology",
"cell_type": "code",
"source": "df",
"execution_count": 121,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>name</th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>Alice</td>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n </tr>\n <tr>\n <th>1</th>\n <td>Bob</td>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " name calculus algebra geometry\n0 Alice 1 2 3\n1 Bob 4 5 4"
},
"execution_count": 121,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "noticed-charm",
"cell_type": "code",
"source": "df['calculus': 'geometry']",
"execution_count": 122,
"outputs": [
{
"ename": "TypeError",
"evalue": "cannot do slice indexing on RangeIndex with these indexers [calculus] of type str",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/var/folders/h2/9nyrt4p55kq6pdvqg02_zmj40000gn/T/ipykernel_41718/841491957.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'calculus'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'geometry'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36m__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 3428\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3429\u001b[0m \u001b[0;31m# Do we have a slicer (on rows)?\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3430\u001b[0;31m \u001b[0mindexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mconvert_to_index_sliceable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3431\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mindexer\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3432\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mndarray\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/indexing.py\u001b[0m in \u001b[0;36mconvert_to_index_sliceable\u001b[0;34m(obj, key)\u001b[0m\n\u001b[1;32m 2327\u001b[0m \u001b[0midx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2328\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mslice\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2329\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0midx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_convert_slice_indexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkind\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"getitem\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2330\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2331\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/indexes/numeric.py\u001b[0m in \u001b[0;36m_convert_slice_indexer\u001b[0;34m(self, key, kind)\u001b[0m\n\u001b[1;32m 242\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mslice_indexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstart\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstop\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstep\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkind\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mkind\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 243\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 244\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_convert_slice_indexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkind\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mkind\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 245\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 246\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mdoc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mIndex\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_maybe_cast_slice_bound\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36m_convert_slice_indexer\u001b[0;34m(self, key, kind)\u001b[0m\n\u001b[1;32m 3717\u001b[0m \"\"\"\n\u001b[1;32m 3718\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mis_integer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mis_index_slice\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3719\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_validate_indexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"slice\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstart\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"getitem\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3720\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_validate_indexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"slice\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstop\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"getitem\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3721\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_validate_indexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"slice\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstep\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"getitem\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36m_validate_indexer\u001b[0;34m(self, form, key, kind)\u001b[0m\n\u001b[1;32m 5717\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5718\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mkey\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mis_integer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 5719\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_invalid_indexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mform\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5720\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5721\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_maybe_cast_slice_bound\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlabel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mside\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mstr_t\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkind\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mno_default\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mTypeError\u001b[0m: cannot do slice indexing on RangeIndex with these indexers [calculus] of type str"
]
}
]
},
{
"metadata": {
"trusted": false
},
"id": "affiliated-distribution",
"cell_type": "code",
"source": "df[1:2]",
"execution_count": 123,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>name</th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>1</th>\n <td>Bob</td>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " name calculus algebra geometry\n1 Bob 4 5 4"
},
"execution_count": 123,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "increasing-advertising",
"cell_type": "code",
"source": "df.iloc[1:2]",
"execution_count": 124,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>name</th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>1</th>\n <td>Bob</td>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " name calculus algebra geometry\n1 Bob 4 5 4"
},
"execution_count": 124,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "packed-bermuda",
"cell_type": "code",
"source": "df.iloc[:, 1:3]",
"execution_count": 126,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>1</td>\n <td>2</td>\n </tr>\n <tr>\n <th>1</th>\n <td>4</td>\n <td>5</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra\n0 1 2\n1 4 5"
},
"execution_count": 126,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "impossible-parking",
"cell_type": "code",
"source": "df.loc[:, 'calculus': 'algebra']",
"execution_count": 128,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>1</td>\n <td>2</td>\n </tr>\n <tr>\n <th>1</th>\n <td>4</td>\n <td>5</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra\n0 1 2\n1 4 5"
},
"execution_count": 128,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "mediterranean-silver",
"cell_type": "code",
"source": "df",
"execution_count": 129,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>name</th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>Alice</td>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n </tr>\n <tr>\n <th>1</th>\n <td>Bob</td>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " name calculus algebra geometry\n0 Alice 1 2 3\n1 Bob 4 5 4"
},
"execution_count": 129,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "understood-athens",
"cell_type": "code",
"source": "df = pd.DataFrame([[1, 2, 3],\n [4, 5, 4]\n ],\n index=['Alice', 'Bob'],\n columns=['calculus', 'algebra', 'geometry']\n )",
"execution_count": 130,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "awful-exhibit",
"cell_type": "code",
"source": "df",
"execution_count": 131,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry\nAlice 1 2 3\nBob 4 5 4"
},
"execution_count": 131,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "flush-salem",
"cell_type": "code",
"source": "df.loc['Alice']",
"execution_count": 133,
"outputs": [
{
"data": {
"text/plain": "calculus 1\nalgebra 2\ngeometry 3\nName: Alice, dtype: int64"
},
"execution_count": 133,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "common-imagination",
"cell_type": "code",
"source": "df.loc[:, 'calculus']",
"execution_count": 137,
"outputs": [
{
"data": {
"text/plain": "Alice 1\nBob 4\nName: calculus, dtype: int64"
},
"execution_count": 137,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "activated-czech",
"cell_type": "code",
"source": "df",
"execution_count": 138,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry\nAlice 1 2 3\nBob 4 5 4"
},
"execution_count": 138,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "brave-specialist",
"cell_type": "code",
"source": "df.iloc[:, 2]",
"execution_count": 139,
"outputs": [
{
"data": {
"text/plain": "Alice 3\nBob 4\nName: geometry, dtype: int64"
},
"execution_count": 139,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "inclusive-undergraduate",
"cell_type": "code",
"source": "df",
"execution_count": 140,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry\nAlice 1 2 3\nBob 4 5 4"
},
"execution_count": 140,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "accurate-truth",
"cell_type": "code",
"source": "df",
"execution_count": 141,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry\nAlice 1 2 3\nBob 4 5 4"
},
"execution_count": 141,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "swiss-tongue",
"cell_type": "code",
"source": "df.mean()",
"execution_count": 142,
"outputs": [
{
"data": {
"text/plain": "calculus 2.5\nalgebra 3.5\ngeometry 3.5\ndtype: float64"
},
"execution_count": 142,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "hazardous-utilization",
"cell_type": "code",
"source": "df.mean(axis=1)",
"execution_count": 143,
"outputs": [
{
"data": {
"text/plain": "Alice 2.000000\nBob 4.333333\ndtype: float64"
},
"execution_count": 143,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "academic-price",
"cell_type": "code",
"source": "df['average'] = df.mean(axis=1)",
"execution_count": 144,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "chemical-classic",
"cell_type": "code",
"source": "df",
"execution_count": 145,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nAlice 1 2 3 2.000000\nBob 4 5 4 4.333333"
},
"execution_count": 145,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "automated-charge",
"cell_type": "code",
"source": "df.loc['Claudia'] = [1, 2, 3, 4]",
"execution_count": 146,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "equipped-present",
"cell_type": "code",
"source": "df",
"execution_count": 147,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n <tr>\n <th>Claudia</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>4.000000</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nAlice 1 2 3 2.000000\nBob 4 5 4 4.333333\nClaudia 1 2 3 4.000000"
},
"execution_count": 147,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "pressing-sweet",
"cell_type": "code",
"source": "df['calculus']",
"execution_count": 148,
"outputs": [
{
"data": {
"text/plain": "Alice 1\nBob 4\nClaudia 1\nName: calculus, dtype: int64"
},
"execution_count": 148,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "standard-preparation",
"cell_type": "code",
"source": "df.algebra",
"execution_count": 149,
"outputs": [
{
"data": {
"text/plain": "Alice 2\nBob 5\nClaudia 2\nName: algebra, dtype: int64"
},
"execution_count": 149,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "partial-south",
"cell_type": "code",
"source": "df.calculus",
"execution_count": 150,
"outputs": [
{
"data": {
"text/plain": "Alice 1\nBob 4\nClaudia 1\nName: calculus, dtype: int64"
},
"execution_count": 150,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "together-football",
"cell_type": "code",
"source": "df.sum = [1, 2, 3]",
"execution_count": 151,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "impaired-pavilion",
"cell_type": "code",
"source": "df",
"execution_count": 152,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n <tr>\n <th>Claudia</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>4.000000</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nAlice 1 2 3 2.000000\nBob 4 5 4 4.333333\nClaudia 1 2 3 4.000000"
},
"execution_count": 152,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "formed-tyler",
"cell_type": "code",
"source": "df['sum'] = [1, 2, 3]",
"execution_count": 153,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "enabling-writer",
"cell_type": "code",
"source": "df",
"execution_count": 154,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n <th>sum</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n <td>1</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n <td>2</td>\n </tr>\n <tr>\n <th>Claudia</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>4.000000</td>\n <td>3</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average sum\nAlice 1 2 3 2.000000 1\nBob 4 5 4 4.333333 2\nClaudia 1 2 3 4.000000 3"
},
"execution_count": 154,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "abroad-silly",
"cell_type": "code",
"source": "del df['sum']",
"execution_count": 155,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "handmade-associate",
"cell_type": "code",
"source": "df",
"execution_count": 156,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n <tr>\n <th>Claudia</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>4.000000</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nAlice 1 2 3 2.000000\nBob 4 5 4 4.333333\nClaudia 1 2 3 4.000000"
},
"execution_count": 156,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "previous-catalyst",
"cell_type": "code",
"source": "dropped_df = df.drop(['average', 'geometry'], axis=1)",
"execution_count": 160,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "approximate-editing",
"cell_type": "code",
"source": "df",
"execution_count": 161,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n <tr>\n <th>Claudia</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>4.000000</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nAlice 1 2 3 2.000000\nBob 4 5 4 4.333333\nClaudia 1 2 3 4.000000"
},
"execution_count": 161,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "overall-geneva",
"cell_type": "code",
"source": "dropped_df",
"execution_count": 162,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n </tr>\n <tr>\n <th>Claudia</th>\n <td>1</td>\n <td>2</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra\nAlice 1 2\nBob 4 5\nClaudia 1 2"
},
"execution_count": 162,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "naked-workstation",
"cell_type": "code",
"source": "df.drop('Claudia')",
"execution_count": 164,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nAlice 1 2 3 2.000000\nBob 4 5 4 4.333333"
},
"execution_count": 164,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "stretch-kernel",
"cell_type": "code",
"source": "df.drop('Claudia', axis='index')",
"execution_count": 168,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nAlice 1 2 3 2.000000\nBob 4 5 4 4.333333"
},
"execution_count": 168,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "heard-albuquerque",
"cell_type": "code",
"source": "df",
"execution_count": 169,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n <tr>\n <th>Claudia</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>4.000000</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nAlice 1 2 3 2.000000\nBob 4 5 4 4.333333\nClaudia 1 2 3 4.000000"
},
"execution_count": 169,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "fantastic-singapore",
"cell_type": "code",
"source": "df.drop('Claudia', axis='index', inplace=True)",
"execution_count": 172,
"outputs": [
{
"ename": "KeyError",
"evalue": "\"['Claudia'] not found in axis\"",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/var/folders/h2/9nyrt4p55kq6pdvqg02_zmj40000gn/T/ipykernel_41718/2261229351.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Claudia'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'index'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minplace\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/util/_decorators.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 309\u001b[0m \u001b[0mstacklevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstacklevel\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 310\u001b[0m )\n\u001b[0;32m--> 311\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 312\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 313\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36mdrop\u001b[0;34m(self, labels, axis, index, columns, level, inplace, errors)\u001b[0m\n\u001b[1;32m 4904\u001b[0m \u001b[0mweight\u001b[0m \u001b[0;36m1.0\u001b[0m \u001b[0;36m0.8\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4905\u001b[0m \"\"\"\n\u001b[0;32m-> 4906\u001b[0;31m return super().drop(\n\u001b[0m\u001b[1;32m 4907\u001b[0m \u001b[0mlabels\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4908\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0maxis\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36mdrop\u001b[0;34m(self, labels, axis, index, columns, level, inplace, errors)\u001b[0m\n\u001b[1;32m 4148\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlabels\u001b[0m \u001b[0;32min\u001b[0m \u001b[0maxes\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4149\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlabels\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 4150\u001b[0;31m \u001b[0mobj\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_drop_axis\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlevel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4151\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4152\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0minplace\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36m_drop_axis\u001b[0;34m(self, labels, axis, level, errors)\u001b[0m\n\u001b[1;32m 4183\u001b[0m \u001b[0mnew_axis\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlevel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4184\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 4185\u001b[0;31m \u001b[0mnew_axis\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4186\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0maxis_name\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mnew_axis\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4187\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py3.10/lib/python3.10/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36mdrop\u001b[0;34m(self, labels, errors)\u001b[0m\n\u001b[1;32m 6015\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mmask\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0many\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6016\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0merrors\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;34m\"ignore\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 6017\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"{labels[mask]} not found in axis\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6018\u001b[0m \u001b[0mindexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mindexer\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m~\u001b[0m\u001b[0mmask\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6019\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdelete\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mKeyError\u001b[0m: \"['Claudia'] not found in axis\""
]
}
]
},
{
"metadata": {
"trusted": false
},
"id": "manufactured-yesterday",
"cell_type": "code",
"source": "df",
"execution_count": 171,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nAlice 1 2 3 2.000000\nBob 4 5 4 4.333333"
},
"execution_count": 171,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "animated-blues",
"cell_type": "code",
"source": "df",
"execution_count": 173,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nAlice 1 2 3 2.000000\nBob 4 5 4 4.333333"
},
"execution_count": 173,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "distinct-specification",
"cell_type": "code",
"source": "df * 2",
"execution_count": 174,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>2</td>\n <td>4</td>\n <td>6</td>\n <td>4.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>8</td>\n <td>10</td>\n <td>8</td>\n <td>8.666667</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nAlice 2 4 6 4.000000\nBob 8 10 8 8.666667"
},
"execution_count": 174,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "theoretical-murder",
"cell_type": "code",
"source": "df + pd.Series([1, 2, 3, 4])",
"execution_count": 176,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>0</th>\n <th>1</th>\n <th>2</th>\n <th>3</th>\n <th>algebra</th>\n <th>average</th>\n <th>calculus</th>\n <th>geometry</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>NaN</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>NaN</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>NaN</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>NaN</td>\n <td>NaN</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " 0 1 2 3 algebra average calculus geometry\nAlice NaN NaN NaN NaN NaN NaN NaN NaN\nBob NaN NaN NaN NaN NaN NaN NaN NaN"
},
"execution_count": 176,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "lucky-tolerance",
"cell_type": "code",
"source": "df + pd.Series([1, 2, 3, 4], index=['calculus', 'algebra', 'geometry', 'average'])",
"execution_count": 179,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>2</td>\n <td>4</td>\n <td>6</td>\n <td>6.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>5</td>\n <td>7</td>\n <td>7</td>\n <td>8.333333</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nAlice 2 4 6 6.000000\nBob 5 7 7 8.333333"
},
"execution_count": 179,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "lonely-validation",
"cell_type": "code",
"source": "df",
"execution_count": 180,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nAlice 1 2 3 2.000000\nBob 4 5 4 4.333333"
},
"execution_count": 180,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "experimental-consciousness",
"cell_type": "code",
"source": "df[df['average'] > 3.5]",
"execution_count": 181,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nBob 4 5 4 4.333333"
},
"execution_count": 181,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "partial-wellington",
"cell_type": "code",
"source": "df['average'] > 3.5",
"execution_count": 182,
"outputs": [
{
"data": {
"text/plain": "Alice False\nBob True\nName: average, dtype: bool"
},
"execution_count": 182,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "opposite-anxiety",
"cell_type": "code",
"source": "df.query('average > 3.5')",
"execution_count": 189,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nBob 4 5 4 4.333333"
},
"execution_count": 189,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "sharing-exchange",
"cell_type": "code",
"source": "import numpy as np",
"execution_count": 185,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "under-wilson",
"cell_type": "code",
"source": "df[lambda x: np.sqrt(x.average) > 1.5]",
"execution_count": 187,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nBob 4 5 4 4.333333"
},
"execution_count": 187,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "perfect-hollywood",
"cell_type": "code",
"source": "df",
"execution_count": 190,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nAlice 1 2 3 2.000000\nBob 4 5 4 4.333333"
},
"execution_count": 190,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "spatial-firewall",
"cell_type": "code",
"source": "df.sort_values('calculus', ascending=False)",
"execution_count": 191,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nBob 4 5 4 4.333333\nAlice 1 2 3 2.000000"
},
"execution_count": 191,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "imposed-devil",
"cell_type": "code",
"source": "df.sort_values(['calculus', 'geometry'], ascending=[False, True])",
"execution_count": 193,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>calculus</th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Bob</th>\n <td>4</td>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " calculus algebra geometry average\nBob 4 5 4 4.333333\nAlice 1 2 3 2.000000"
},
"execution_count": 193,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "current-master",
"cell_type": "code",
"source": "df.drop('calculus', axis=1)",
"execution_count": 194,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>algebra</th>\n <th>geometry</th>\n <th>average</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>2</td>\n <td>3</td>\n <td>2.000000</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>5</td>\n <td>4</td>\n <td>4.333333</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " algebra geometry average\nAlice 2 3 2.000000\nBob 5 4 4.333333"
},
"execution_count": 194,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "friendly-language",
"cell_type": "code",
"source": "df.drop(['average', 'calculus'], axis=1).to_clipboard()",
"execution_count": 199,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "banned-nitrogen",
"cell_type": "code",
"source": "pd.DataFrame({'algebra': [1, 2, 3],\n 'geometry': [2, 3, 4]\n })",
"execution_count": 200,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>algebra</th>\n <th>geometry</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>1</td>\n <td>2</td>\n </tr>\n <tr>\n <th>1</th>\n <td>2</td>\n <td>3</td>\n </tr>\n <tr>\n <th>2</th>\n <td>3</td>\n <td>4</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " algebra geometry\n0 1 2\n1 2 3\n2 3 4"
},
"execution_count": 200,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "innocent-sample",
"cell_type": "code",
"source": "pd.DataFrame({'algebra': {'Alice': 1, 'Bob': 2, 'Claudia': 3},\n 'geometry': {'Alice': 2, 'Bob': 3, 'Claudia': 4}\n })",
"execution_count": 201,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>algebra</th>\n <th>geometry</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>1</td>\n <td>2</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>2</td>\n <td>3</td>\n </tr>\n <tr>\n <th>Claudia</th>\n <td>3</td>\n <td>4</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " algebra geometry\nAlice 1 2\nBob 2 3\nClaudia 3 4"
},
"execution_count": 201,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "czech-understanding",
"cell_type": "code",
"source": "pd.DataFrame([{'algebra': 3, 'geometry': 4},\n {'algebra': 2, 'geometry': 2}\n ], index=['Alice', 'Bob'])",
"execution_count": 203,
"outputs": [
{
"data": {
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>algebra</th>\n <th>geometry</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Alice</th>\n <td>3</td>\n <td>4</td>\n </tr>\n <tr>\n <th>Bob</th>\n <td>2</td>\n <td>2</td>\n </tr>\n </tbody>\n</table>\n</div>",
"text/plain": " algebra geometry\nAlice 3 4\nBob 2 2"
},
"execution_count": 203,
"metadata": {},
"output_type": "execute_result"
}
]
}
],
"metadata": {
"kernelspec": {
"name": "py3.10",
"display_name": "Python 3.10",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.10.0",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"gist": {
"id": "",
"data": {
"description": "Lesson13",
"public": false
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment