{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
Скриншот запущенного сваггера:
\n", "\n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": 61, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "data_base = pd.read_csv(\"csv/option4.csv\")\n", "\n", "# data_base.info\n", "\n", "# print(data_base.describe().transpose())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Вызов функции для удобного просмотра столбцов и их значений во время выполнения лабы
" ] }, { "cell_type": "code", "execution_count": 84, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Вызов иной функции для удобного просмотра столбцов и их значений во время выполнения лабы
" ] }, { "cell_type": "code", "execution_count": 85, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['id', 'gender', 'age', 'hypertension', 'heart_disease', 'ever_married',\n", " 'work_type', 'Residence_type', 'avg_glucose_level', 'bmi',\n", " 'smoking_status', 'stroke'],\n", " dtype='object')" ] }, "execution_count": 85, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data_base.columns" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Тренируюсь со срезами...
" ] }, { "cell_type": "code", "execution_count": 44, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " | id | \n", "gender | \n", "age | \n", "hypertension | \n", "heart_disease | \n", "ever_married | \n", "work_type | \n", "Residence_type | \n", "avg_glucose_level | \n", "bmi | \n", "smoking_status | \n", "stroke | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|
10 | \n", "12109 | \n", "Female | \n", "81.0 | \n", "1 | \n", "0 | \n", "Yes | \n", "Private | \n", "Rural | \n", "80.43 | \n", "29.7 | \n", "never smoked | \n", "1 | \n", "
11 | \n", "12095 | \n", "Female | \n", "61.0 | \n", "0 | \n", "1 | \n", "Yes | \n", "Govt_job | \n", "Rural | \n", "120.46 | \n", "36.8 | \n", "smokes | \n", "1 | \n", "
Все еще непонятной фигней занимаюсь...
" ] }, { "cell_type": "code", "execution_count": 58, "metadata": {}, "outputs": [], "source": [ "new_data_base = data_base.sort_values(\"age\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "А тут уже что-то интересное.
Я отбираю количество (сколько раз встречается в таблице) каждое из значений колонки \"статус_курильщика\" Потом с помощью функции plot отрисовываю круговую диаграмму