AIM-PIbd-31-Barsukov-P-O/lab_1/lab1.ipynb

169 lines
117 KiB
Plaintext
Raw Normal View History

2024-09-15 21:27:11 +04:00
{
"cells": [
{
"cell_type": "code",
2024-09-22 01:25:20 +04:00
"execution_count": 3,
2024-09-15 21:27:11 +04:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Index(['age', 'sex', 'bmi', 'children', 'smoker', 'region', 'charges'], dtype='object')\n"
]
}
],
"source": [
"import pandas as pd\n",
2024-09-22 01:25:20 +04:00
"df = pd.read_csv(\"../dataset.csv\")\n",
2024-09-15 21:27:11 +04:00
"print(df.columns)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Данная диаграмма отображает зависимость курения от стоимости страховки, что позволяет сделать вывод о том, что курящие люди платят больше за страховку"
]
},
{
"cell_type": "code",
2024-09-22 01:25:20 +04:00
"execution_count": 4,
2024-09-15 21:27:11 +04:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Axes: xlabel='smoker', ylabel='charges'>"
]
},
2024-09-22 01:25:20 +04:00
"execution_count": 4,
2024-09-15 21:27:11 +04:00
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAk0AAAGwCAYAAAC0HlECAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABCq0lEQVR4nO3de3QU9f3/8VcSciXkQiAJlAQQkJsBDJeQildSokYrFRWUWqqoRQMtpMql8gX1W8ViW8CCgtoW+2v9ilixShSMQQKFyCUYBYQICAbETQIkWQiQ6/7+oNkSCbNLWGYn5Pk4Z88h8/5k5r0bztnXmfnMZ3wcDodDAAAAMOTr7QYAAACaA0ITAACAGwhNAAAAbiA0AQAAuIHQBAAA4AZCEwAAgBsITQAAAG5o5e0GLhd1dXU6fPiw2rRp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ouXwcDofDWwefPn26NmzYoPXr1zdadzgc6tixo37961/r8ccflySVl5crJiZGS5cu1ZgxY7Rr1y716dNHW7Zs0aBBgyRJq1at0q233qpDhw6pY8eOevnll/Xkk0/KZrMpICDAeex3331Xu3fvliSNHj1aFRUVWrlypfP4Q4cO1YABA7R48eJzequsrFRlZaXzZ7vdrri4OJWXlyssLOyiP5ucgmKN++uW89b/3/ghXKoDAOAi2e12hYeHu/X97dUzTe+9954GDRqku+++W9HR0br66qv16quvOuv79++XzWZTSkqKc1t4eLiSkpKUm5srScrNzVVERIQzMElSSkqKfH19tWnTJueY6667zhmYJCk1NVUFBQUqLS11jjn7OPVj6o/zfXPmzFF4eLjzFRcXd5GfRkP5h8oM69sKSz16PAAAYMyroenrr7/Wyy+/rB49emj16tV69NFH9ctf/lKvv/66JMlms0mSYmJiGvxeTEyMs2az2RQdHd2g3qpVK7Vt27bBmMb2cfYxzjemvv59M2bMUHl5ufN18ODBC37/RgZ0ijCsJ8ZHGtYBAIBnefXuubq6Og0aNEjPPfecJOnqq6/Wjh07tHjxYo0bN86brbkUGBiowMDAS7b/63tGKzLE/5w5TdKZh/ZyaQ4AAHN59UxThw4d1KdPnwbbevfurcLCQklSbGysJKmoqKjBmKKiImctNjZWxcXFDeo1NTU6duxYgzGN7ePsY5xvTH3dG95LH6bIEP8G2yJD/PVe+jAvdQQAQMvl1dB0zTXXqKCgoMG2r776Sp07d5Ykde3aVbGxscrOznbW7Xa7Nm3apOTkZElScnKyysrKlJeX5xyzZs0a1dXVKSkpyTlm3bp1qq7+71mbrKws9ezZ03mnXnJycoPj1I+pP443xEWF6LNZI/TEiCuVfEVbTU3tqc9mjVBcVIjXegIAoMVyeNHmzZsdrVq1cjz77LOOPXv2OP7xj384QkJCHH//+9+dY55//nlHRESE41//+pfjiy++cNxxxx2Orl27Ok6dOuUcc/PNNzuuvvpqx6ZNmxz//ve/HT169HDce++9znpZWZkjJibGcf/99zt27NjhePPNNx0hISGOJUuWOMds2LDB0apVK8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LYskBAACsxauh6amnnpKPj0+DV69evZz106dPKz09XVFRUQoNDdWoUaNUVFTUYB+FhYVKS0tTSEiIoqOj9cQTT6impqbBmLVr1yoxMVGBgYHq3r27li5dek4vixYtUpcuXRQUFKSkpCRt3rz5krznC8GSAwAAWEcrbzfQt29fffzxx86fW7X6b0tTpkxRZmamli9frvDwcE2cOFF33nmnNmzYIEmqra1VWlqaYmNjtXHjRn333Xf62c9+Jn9/fz333HOSpP379ystLU0TJkzQP/7xD2VnZ+uhhx5Shw4dlJqaKklatmyZMjIytHjxYiUlJWn+/PlKTU1VQUGBoqOjTfw0Goq
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"df.plot.scatter(x=\"smoker\", y=\"charges\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Данная диаграмма отображает зависимость количества детей от стоимости страховки, что позволяет сделать вывод о том, что люди с двумя и тремя детьми платят наиболее высокую цену за страховку. Однако в силу других факторов люди с одним ребенком или без детей могут платить даже большую цену"
]
},
{
"cell_type": "code",
2024-09-22 01:25:20 +04:00
"execution_count": 9,
2024-09-15 21:27:11 +04:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 5\n"
]
},
{
"data": {
"text/plain": [
"<Axes: title={'center': 'charges'}, xlabel='children'>"
]
},
2024-09-22 01:25:20 +04:00
"execution_count": 9,
2024-09-15 21:27:11 +04:00
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkkAAAHNCAYAAAAKSe9nAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABxuUlEQVR4nO3deVxUZfs/8M/AMINsAiqDiKK54b7gRporQmKWZWVWai75JCgKCWaPgZKlAYlLEvVYkpUttmg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h2LFj0tfA1LkTGYtjkogekJ2dHQYMGIDFixfjn3/+Qbt27ap9jU2bNgEAbt68iX/++afSL5OaoE6dOvf93LstYqgb2F5dFRUVAICXX34ZY8eONRjTsWPH+7q2sQy9ppCQEKhUKnzxxRfo27cvvvjiC3h7eyMoKMhkn/f2cW63E0ZMAHhQd74HKioqIJPJ8PPPPxvM6/ZeSsCyuVPtxCKJyATKysoAAEVFRQBurTPzyy+/oLCwUK836fjx49J5nYMHDyI+Ph7jxo3DgQMHMHHiRBw6dAh169bV+xwVFRX4999/pd4jAPj7778B4K4DnBs0aAAnJyecOHGi0rnjx4/Dzs4OjRs3BnD3QsQQXf4nT56sdM7Qsaqucbfc6tevL91i8vDwQH5+fqW423vkbvfPP/9UOvb333/DyclJuuXn6uqK8vLyexYgfn5+OHz4MIQQem1kKO+q3Fn8njx5EhUVFXpfO3t7e7z44otIS0v
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"print(df[\"children\"].min(), df[\"children\"].max())\n",
"df.boxplot(column=\"charges\", by=\"children\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Данная диаграмма отображает зависимость возраста от стоимости страховки, что позволяет сделать вывод о том, что более старые люди платят большую цену за страховку. Желтым цветом составлен тот же самый график, но только на срезе с первой по тридцатую строку, он показывает, что на мельшей выборке можно проследить общую динамику, но сам график становится менее точным"
]
},
{
"cell_type": "code",
2024-09-22 01:25:20 +04:00
"execution_count": 6,
2024-09-15 21:27:11 +04:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Axes: xlabel='age'>"
]
},
2024-09-22 01:25:20 +04:00
"execution_count": 6,
2024-09-15 21:27:11 +04:00
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjkAAAGwCAYAAABLvHTgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0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KgoICHnzwQX7yk5+wdu1a/Zi3336bhQsX8thjj7F9+3bGjx9Pbm4uJSUlXflZiGBmbYamWvVrs/MU8l6eydGXqxLVz/GZ6mepyxFCCM+CnBtuuIHrrruOYcOGMXz4cH73u98RGxvL5s2b9WOio6PJyMjQP+Lj4/XrPvnkE/bt28frr7/OhAkTmDlzJk8++STLli3DYlEbmi1fvpzBgwfzzDPPMGrUKObPn8/3vvc9nnvuOf1+nn32We69917uuususrOzWb58OdHR0fztb3/r6s9DBCut6Bhkd5Uz55occApyJJMjhBBe1+RYrVbeeustamtrycnJ0S9/4403SE1NZcyYMSxatIi6ujr9ury8PMaOHUt6erp+WW5uLlVVVXo2KC8vj+nTp7s8Vm5uLnl5eQBYLBby8/NdjjEajUyfPl0/pj2NjY1UVVW5fIgQoS1VhUeDKVxqcjT1FernlkGO1OQIIQRhnt5g9+7d5OTk0NDQQGxsLO+//z7Z2dkA3H777QwcOJDMzEx27drFI488wsGDB3nvvfcAKCoqcglwAP37oqKiDo+pqqqivr6e8vJyrFZrm8ccOHCgw3NfsmQJv/nNbzx9yiIYOG8fB8nkaFpmcqRXjhBC6DwOckaMGEFBQQGVlZX861//Yu7cuWzcuJHs7Gx++tOf6seNHTu
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"avg = df.groupby('age')['charges'].mean()\n",
"avg.plot.line()\n",
"\n",
"subset = df.iloc[0:30]\n",
"avg = subset.groupby('age')['charges'].mean()\n",
"avg.plot.line()"
]
}
],
"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.12.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}