--- a +++ b/.ipynb_checkpoints/smoking-checkpoint.ipynb @@ -0,0 +1,84 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "00b82428", + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + " cardio_data = pd.read_csv('cardio_train.csv', sep=';')\n", + " print(cardio_data.head())\n", + " smokers = cardio_data[cardio_data['smoke'] == 1]\n", + " average_age = smokers['age'].mean()\n", + " mode_age = smokers['age'].mode()[0]\n", + " print('The average age of smokers ', average_age / 365)\n", + " print('The most repeated age of smokers ', mode_age / 365)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cc7922cd", + "metadata": {}, + "outputs": [], + "source": [ + "cardio_data_2 = pd.read_csv('heart_data.csv')\n", + "print(cardio_data_2.head())" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9bb3ff25", + "metadata": {}, + "outputs": [], + "source": [ + "smokers = cardio_data_2[cardio_data_2['Smoking'] == 1]\n", + "smokers['Heart']" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7e85f38d", + "metadata": {}, + "outputs": [], + "source": [ + "nonsmokers = cardio_data_2[cardio_data_2]['Smoking'==0]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9f1517c9", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.10.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}