721 lines
173 KiB
Plaintext
721 lines
173 KiB
Plaintext
|
{
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Работа с NumPy"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 14,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"matrix = \n",
|
|||
|
" [[4 5 0]\n",
|
|||
|
" [9 9 9]] \n",
|
|||
|
"\n",
|
|||
|
"tmatrix = \n",
|
|||
|
" [[4 9]\n",
|
|||
|
" [5 9]\n",
|
|||
|
" [0 9]] \n",
|
|||
|
"\n",
|
|||
|
"vector = \n",
|
|||
|
" [4 5 0 9 9 9] \n",
|
|||
|
"\n",
|
|||
|
"tvector = \n",
|
|||
|
" [[4]\n",
|
|||
|
" [5]\n",
|
|||
|
" [0]\n",
|
|||
|
" [9]\n",
|
|||
|
" [9]\n",
|
|||
|
" [9]] \n",
|
|||
|
"\n",
|
|||
|
"list_matrix = \n",
|
|||
|
" [array([4, 5, 0]), array([9, 9, 9])] \n",
|
|||
|
"\n",
|
|||
|
"matrix as str = \n",
|
|||
|
" [[4 5 0]\n",
|
|||
|
" [9 9 9]] \n",
|
|||
|
"\n",
|
|||
|
"matrix type is <class 'numpy.ndarray'> \n",
|
|||
|
"\n",
|
|||
|
"vector type is <class 'numpy.ndarray'> \n",
|
|||
|
"\n",
|
|||
|
"list_matrix type is <class 'list'> \n",
|
|||
|
"\n",
|
|||
|
"str_matrix type is <class 'str'> \n",
|
|||
|
"\n",
|
|||
|
"formatted_vector = \n",
|
|||
|
" 4; 5; 0; 9; 9; 9 \n",
|
|||
|
"\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"import numpy as np\n",
|
|||
|
"\n",
|
|||
|
"matrix = np.array([[4, 5, 0], [9, 9, 9]])\n",
|
|||
|
"print(\"matrix = \\n\", matrix, \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"tmatrix = matrix.T\n",
|
|||
|
"print(\"tmatrix = \\n\", tmatrix, \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"vector = np.ravel(matrix)\n",
|
|||
|
"print(\"vector = \\n\", vector, \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"tvector = np.reshape(vector, (6, 1))\n",
|
|||
|
"print(\"tvector = \\n\", tvector, \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"list_matrix = list(matrix)\n",
|
|||
|
"print(\"list_matrix = \\n\", list_matrix, \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"str_matrix = str(matrix)\n",
|
|||
|
"print(\"matrix as str = \\n\", str_matrix, \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"print(\"matrix type is\", type(matrix), \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"print(\"vector type is\", type(vector), \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"print(\"list_matrix type is\", type(list_matrix), \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"print(\"str_matrix type is\", type(str_matrix), \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"formatted_vector = \"; \".join(map(str, vector))\n",
|
|||
|
"print(\"formatted_vector = \\n\", formatted_vector, \"\\n\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Работа с Pandas DataFrame\n",
|
|||
|
"\n",
|
|||
|
"https://pandas.pydata.org/docs/user_guide/10min.html"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Работа с данными - чтение и запись CSV"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 15,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"import pandas as pd\n",
|
|||
|
"\n",
|
|||
|
"df = pd.read_csv(\"data/titanic.csv\", index_col=\"PassengerId\")\n",
|
|||
|
"\n",
|
|||
|
"df.to_csv(\"test.csv\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Работа с данными - основные команды"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 16,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"<class 'pandas.core.frame.DataFrame'>\n",
|
|||
|
"Index: 891 entries, 1 to 891\n",
|
|||
|
"Data columns (total 11 columns):\n",
|
|||
|
" # Column Non-Null Count Dtype \n",
|
|||
|
"--- ------ -------------- ----- \n",
|
|||
|
" 0 Survived 891 non-null int64 \n",
|
|||
|
" 1 Pclass 891 non-null int64 \n",
|
|||
|
" 2 Name 891 non-null object \n",
|
|||
|
" 3 Sex 891 non-null object \n",
|
|||
|
" 4 Age 714 non-null float64\n",
|
|||
|
" 5 SibSp 891 non-null int64 \n",
|
|||
|
" 6 Parch 891 non-null int64 \n",
|
|||
|
" 7 Ticket 891 non-null object \n",
|
|||
|
" 8 Fare 891 non-null float64\n",
|
|||
|
" 9 Cabin 204 non-null object \n",
|
|||
|
" 10 Embarked 889 non-null object \n",
|
|||
|
"dtypes: float64(2), int64(4), object(5)\n",
|
|||
|
"memory usage: 83.5+ KB\n",
|
|||
|
" count mean std min 25% 50% 75% max\n",
|
|||
|
"Survived 891.0 0.383838 0.486592 0.00 0.0000 0.0000 1.0 1.0000\n",
|
|||
|
"Pclass 891.0 2.308642 0.836071 1.00 2.0000 3.0000 3.0 3.0000\n",
|
|||
|
"Age 714.0 29.699118 14.526497 0.42 20.1250 28.0000 38.0 80.0000\n",
|
|||
|
"SibSp 891.0 0.523008 1.102743 0.00 0.0000 0.0000 1.0 8.0000\n",
|
|||
|
"Parch 891.0 0.381594 0.806057 0.00 0.0000 0.0000 0.0 6.0000\n",
|
|||
|
"Fare 891.0 32.204208 49.693429 0.00 7.9104 14.4542 31.0 512.3292\n",
|
|||
|
" Survived Pclass Sex Age SibSp Parch Fare Cabin\n",
|
|||
|
"PassengerId \n",
|
|||
|
"1 0 3 male 22.0 1 0 7.2500 NaN\n",
|
|||
|
"2 1 1 female 38.0 1 0 71.2833 C85\n",
|
|||
|
"3 1 3 female 26.0 0 0 7.9250 NaN\n",
|
|||
|
"4 1 1 female 35.0 1 0 53.1000 C123\n",
|
|||
|
"5 0 3 male 35.0 0 0 8.0500 NaN\n",
|
|||
|
" Survived Pclass Sex Age SibSp Parch Fare Cabin\n",
|
|||
|
"PassengerId \n",
|
|||
|
"887 0 2 male 27.0 0 0 13.00 NaN\n",
|
|||
|
"888 1 1 female 19.0 0 0 30.00 B42\n",
|
|||
|
"889 0 3 female NaN 1 2 23.45 NaN\n",
|
|||
|
"890 1 1 male 26.0 0 0 30.00 C148\n",
|
|||
|
"891 0 3 male 32.0 0 0 7.75 NaN\n",
|
|||
|
" Survived Pclass Sex Age SibSp Parch Fare Cabin\n",
|
|||
|
"PassengerId \n",
|
|||
|
"804 1 3 male 0.42 0 1 8.5167 NaN\n",
|
|||
|
"756 1 2 male 0.67 1 1 14.5000 NaN\n",
|
|||
|
"470 1 3 female 0.75 2 1 19.2583 NaN\n",
|
|||
|
"645 1 3 female 0.75 2 1 19.2583 NaN\n",
|
|||
|
"79 1 2 male 0.83 0 2 29.0000 NaN\n",
|
|||
|
" Survived Pclass Sex Age SibSp Parch Fare Cabin\n",
|
|||
|
"PassengerId \n",
|
|||
|
"860 0 3 male NaN 0 0 7.2292 NaN\n",
|
|||
|
"864 0 3 female NaN 8 2 69.5500 NaN\n",
|
|||
|
"869 0 3 male NaN 0 0 9.5000 NaN\n",
|
|||
|
"879 0 3 male NaN 0 0 7.8958 NaN\n",
|
|||
|
"889 0 3 female NaN 1 2 23.4500 NaN\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.info()\n",
|
|||
|
"\n",
|
|||
|
"print(df.describe().transpose())\n",
|
|||
|
"\n",
|
|||
|
"cleared_df = df.drop([\"Name\", \"Ticket\", \"Embarked\"], axis=1)\n",
|
|||
|
"print(cleared_df.head())\n",
|
|||
|
"print(cleared_df.tail())\n",
|
|||
|
"\n",
|
|||
|
"sorted_df = cleared_df.sort_values(by=\"Age\")\n",
|
|||
|
"print(sorted_df.head())\n",
|
|||
|
"print(sorted_df.tail())"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Работа с данными - работа с элементами"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 17,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"PassengerId\n",
|
|||
|
"1 22.0\n",
|
|||
|
"2 38.0\n",
|
|||
|
"3 26.0\n",
|
|||
|
"4 35.0\n",
|
|||
|
"5 35.0\n",
|
|||
|
" ... \n",
|
|||
|
"887 27.0\n",
|
|||
|
"888 19.0\n",
|
|||
|
"889 NaN\n",
|
|||
|
"890 26.0\n",
|
|||
|
"891 32.0\n",
|
|||
|
"Name: Age, Length: 891, dtype: float64\n",
|
|||
|
"Survived 0\n",
|
|||
|
"Pclass 2\n",
|
|||
|
"Name Kantor, Mr. Sinai\n",
|
|||
|
"Sex male\n",
|
|||
|
"Age 34.0\n",
|
|||
|
"SibSp 1\n",
|
|||
|
"Parch 0\n",
|
|||
|
"Ticket 244367\n",
|
|||
|
"Fare 26.0\n",
|
|||
|
"Cabin NaN\n",
|
|||
|
"Embarked S\n",
|
|||
|
"Name: 100, dtype: object\n",
|
|||
|
"Kantor, Mr. Sinai\n",
|
|||
|
" Age Name\n",
|
|||
|
"PassengerId \n",
|
|||
|
"100 34.0 Kantor, Mr. Sinai\n",
|
|||
|
"101 28.0 Petranec, Miss. Matilda\n",
|
|||
|
"102 NaN Petroff, Mr. Pastcho (\"Pentcho\")\n",
|
|||
|
"103 21.0 White, Mr. Richard Frasar\n",
|
|||
|
"104 33.0 Johansson, Mr. Gustaf Joel\n",
|
|||
|
"... ... ...\n",
|
|||
|
"196 58.0 Lurette, Miss. Elise\n",
|
|||
|
"197 NaN Mernagh, Mr. Robert\n",
|
|||
|
"198 42.0 Olsen, Mr. Karl Siegwart Andreas\n",
|
|||
|
"199 NaN Madigan, Miss. Margaret \"Maggie\"\n",
|
|||
|
"200 24.0 Yrois, Miss. Henriette (\"Mrs Harbeck\")\n",
|
|||
|
"\n",
|
|||
|
"[101 rows x 2 columns]\n",
|
|||
|
" Survived Pclass \\\n",
|
|||
|
"PassengerId \n",
|
|||
|
"1 0 3 \n",
|
|||
|
"2 1 1 \n",
|
|||
|
"3 1 3 \n",
|
|||
|
"\n",
|
|||
|
" Name Sex Age \\\n",
|
|||
|
"PassengerId \n",
|
|||
|
"1 Braund, Mr. Owen Harris male 22.0 \n",
|
|||
|
"2 Cumings, Mrs. John Bradley (Florence Briggs Th... female 38.0 \n",
|
|||
|
"3 Heikkinen, Miss. Laina female 26.0 \n",
|
|||
|
"\n",
|
|||
|
" SibSp Parch Ticket Fare Cabin Embarked \n",
|
|||
|
"PassengerId \n",
|
|||
|
"1 1 0 A/5 21171 7.2500 NaN S \n",
|
|||
|
"2 1 0 PC 17599 71.2833 C85 C \n",
|
|||
|
"3 0 0 STON/O2. 3101282 7.9250 NaN S \n",
|
|||
|
"Survived 0\n",
|
|||
|
"Pclass 3\n",
|
|||
|
"Name Braund, Mr. Owen Harris\n",
|
|||
|
"Sex male\n",
|
|||
|
"Age 22.0\n",
|
|||
|
"SibSp 1\n",
|
|||
|
"Parch 0\n",
|
|||
|
"Ticket A/5 21171\n",
|
|||
|
"Fare 7.25\n",
|
|||
|
"Cabin NaN\n",
|
|||
|
"Embarked S\n",
|
|||
|
"Name: 1, dtype: object\n",
|
|||
|
" Survived Pclass\n",
|
|||
|
"PassengerId \n",
|
|||
|
"4 1 1\n",
|
|||
|
"5 0 3\n",
|
|||
|
" Survived Pclass\n",
|
|||
|
"PassengerId \n",
|
|||
|
"4 1 1\n",
|
|||
|
"5 0 3\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"print(df[\"Age\"])\n",
|
|||
|
"\n",
|
|||
|
"print(df.loc[100])\n",
|
|||
|
"\n",
|
|||
|
"print(df.loc[100, \"Name\"])\n",
|
|||
|
"\n",
|
|||
|
"print(df.loc[100:200, [\"Age\", \"Name\"]])\n",
|
|||
|
"\n",
|
|||
|
"print(df[0:3])\n",
|
|||
|
"\n",
|
|||
|
"print(df.iloc[0])\n",
|
|||
|
"\n",
|
|||
|
"print(df.iloc[3:5, 0:2])\n",
|
|||
|
"\n",
|
|||
|
"print(df.iloc[[3, 4], [0, 1]])"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Работа с данными - отбор и группировка"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 18,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"['male' 'female']\n",
|
|||
|
"male count = 577\n",
|
|||
|
"female count = 314\n",
|
|||
|
"Total count = 891\n",
|
|||
|
" Pclass Survived Count\n",
|
|||
|
"0 1 0 80\n",
|
|||
|
"1 1 1 136\n",
|
|||
|
"2 2 0 97\n",
|
|||
|
"3 2 1 87\n",
|
|||
|
"4 3 0 372\n",
|
|||
|
"5 3 1 119\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"s_values = df[\"Sex\"].unique()\n",
|
|||
|
"print(s_values)\n",
|
|||
|
"\n",
|
|||
|
"s_total = 0\n",
|
|||
|
"for s_value in s_values:\n",
|
|||
|
" count = df[df[\"Sex\"] == s_value].shape[0]\n",
|
|||
|
" s_total += count\n",
|
|||
|
" print(s_value, \"count =\", count)\n",
|
|||
|
"print(\"Total count = \", s_total)\n",
|
|||
|
"\n",
|
|||
|
"print(df.groupby([\"Pclass\", \"Survived\"]).size().reset_index(name=\"Count\")) # type: ignore"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Визуализация - Исходные данные"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 19,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
" Pclass Survived Age\n",
|
|||
|
"PassengerId \n",
|
|||
|
"1 3 0 22.0\n",
|
|||
|
"2 1 1 38.0\n",
|
|||
|
"3 3 1 26.0\n",
|
|||
|
"4 1 1 35.0\n",
|
|||
|
"5 3 0 35.0\n",
|
|||
|
"... ... ... ...\n",
|
|||
|
"886 3 0 39.0\n",
|
|||
|
"887 2 0 27.0\n",
|
|||
|
"888 1 1 19.0\n",
|
|||
|
"890 1 1 26.0\n",
|
|||
|
"891 3 0 32.0\n",
|
|||
|
"\n",
|
|||
|
"[714 rows x 3 columns]\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"data = df[[\"Pclass\", \"Survived\", \"Age\"]].copy()\n",
|
|||
|
"data.dropna(subset=[\"Age\"], inplace=True)\n",
|
|||
|
"print(data)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Визуализация - Сводка пяти чисел\n",
|
|||
|
"\n",
|
|||
|
"<img src=\"assets/quantile.png\" width=\"400\" style=\"background-color: white\">"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 20,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
" Age \n",
|
|||
|
" min q1 q2 median q3 max\n",
|
|||
|
"Pclass \n",
|
|||
|
"1 0.92 27.0 37.0 37.0 49.0 80.0\n",
|
|||
|
"2 0.67 23.0 29.0 29.0 36.0 70.0\n",
|
|||
|
"3 0.42 18.0 24.0 24.0 32.0 74.0"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"\n",
|
|||
|
" Age \n",
|
|||
|
" low_iqr iqr high_iqr\n",
|
|||
|
"Pclass \n",
|
|||
|
"1 0.0 22.0 82.0\n",
|
|||
|
"2 3.5 13.0 55.5\n",
|
|||
|
"3 0.0 14.0 53.0\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"<Axes: title={'center': 'Age'}, xlabel='Pclass'>"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 20,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAi8AAAHNCAYAAADWsJtQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/GU6V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4pkPo6fXx8GnxPGqtbn5q6desGMzMzne/diy++iPPnz+PAgQMAgN27d6OsrAwvvPBCk7bRtWtX5OTkYPfu3Th48CBKS0uRlZWFTp06AQDOnDkDADqnpZrq+++/R2hoqDg2ydnZGdOnTwcAMbyEhIQgLi4Os2fPRqdOnRAdHY309HSd8UHjx49Hjx49EBkZic6dO2Ps2LHYuXOn3vUQtQSOeaF2y8zMDEOHDsXSpUtRWFiI3r17672OXbt2AQBu376NwsLCBh/0bcFv/3LX1716BeoHNOur/r4nf/3rX5GQkNBomz59+jRr3U3V2D5FRETA1dUVa9euxeDBg7F27Vq4ubkhNDS0Seu0tbVtclt9nDlzBsOHD4efnx8WLVoET09PWFpaYvv27Vi8eLH4fspkMmRkZEClUmHbtm3YtWsXxo4di4ULF0KlUsHOzg4uLi7Iz8/Hrl27sGPHDuzYsQPp6el48cUX8cUXX7R47UT3w54Xatdqa2sBALdu3QIAdOnSBSUlJbh586ZOu1OnTonz6/3nP//BnDlz8NJLL+GRRx7B3/72N/Ev2d+qq6vDL7/8ojPt559/BoB7Dmx1dnaGjY0NTp8+3WDeqVOnYGZmBk9PTwB
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"def q1(x):\n",
|
|||
|
" return x.quantile(0.25)\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"# median = quantile(0.5)\n",
|
|||
|
"def q2(x):\n",
|
|||
|
" return x.quantile(0.5)\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"def q3(x):\n",
|
|||
|
" return x.quantile(0.75)\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"def iqr(x):\n",
|
|||
|
" return q3(x) - q1(x)\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"def low_iqr(x):\n",
|
|||
|
" return max(0, q1(x) - 1.5 * iqr(x))\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"def high_iqr(x):\n",
|
|||
|
" return q3(x) + 1.5 * iqr(x)\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"quantiles = data[[\"Pclass\", \"Age\"]].groupby([\"Pclass\"]).aggregate([\"min\", q1, q2, \"median\", q3, \"max\"])\n",
|
|||
|
"print(quantiles)\n",
|
|||
|
"\n",
|
|||
|
"iqrs = data[[\"Pclass\", \"Age\"]].groupby([\"Pclass\"]).aggregate([low_iqr, iqr, high_iqr])\n",
|
|||
|
"print(iqrs)\n",
|
|||
|
"\n",
|
|||
|
"data.boxplot(column=\"Age\", by=\"Pclass\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Визуализация - Гистограмма"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 21,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"<Axes: ylabel='Frequency'>"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 21,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjIAAAGdCAYAAAAIbpn/AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/GU6VOAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAqDklEQVR4nO3de3RU5b3/8c+QG0FyETC3kkDkKkIoImDKpShUbktF8CxUOAalWm1QIFoBrSC1NFQWVDwi9JwDiR5FhC7wWkGIEEqLKGhA9Ge4GAFLuFQlIaEkkHl+f7CY5ZgLyT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AAcExABJnJkyfrnXfe0ZYtW9S2bds6t+3Xr58kaf/+/TUGmYiICEVERDRKnQAAILA4GmSMMXr44Ye1du1abd68WampqRd9T0FBgSQpMTGxkasDAACBztEgk5mZqRUrVujNN99UVFSUjh49KkmKiYlRZGSkDhw4oBUrVmjkyJFq3bq1du/erWnTpmnQoEFKS0tzsnQAABAAHA0yS5YskXT+oXc/lJOTo4kTJyo8PFwbN27Uc889p/LyciUnJ2vs2LH67W9/60C1AAAg0Dh+aakuycnJys/Pb6JqAACAbQLqOTIAAAANQZABAADWIsgAAABrEWQAAIC1CDIAAMBaAfFkXyAYNWSeJACAbzgjAwAArEWQAQAA1iLIAAAAaxFkAACAtQgyAADAWgQZAABgLYIMAACwFkEGAABYiyADAACsRZABAADWIsg
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"data.plot.hist(column=[\"Age\"], bins=80)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Визуализация - Точечная диаграмма"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 22,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"<Axes: xlabel='Pclass', ylabel='Age'>"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 22,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlEAAAGwCAYAAACJjDBkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMywgaHR0cH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d+uuwZW3ZkC6KqOKefyOqBGpc7ys8PiYsyOFyu0ZYsF6+3f1XmZI0sqf7ryuln7/pc/EYy4Z0VucE1/8Vd06I0bIhnVXjom+7hId43t1m3ZfsZYwuHtun90tyG2PZkC5uz1cjLFjT+rb1+Jye/On6ph7b7+tY8v0vOdbzSYgjezZ3qy8s0GNXdWwc6bH9+ubRJa6jbYPqHtu9zdGTvsnu3wCTpNvbev6PhC/+dH1TBQU4Lt1RpbNdxvW+wuO+5Mv+4e35vNUXeNH0ggIcmnVfssf9dNZ9yW6vh7dXx1vNno6Bi4/ZomN4qsPbmnBlfdf92tsx7m1NaBcbpaCLDv+gAIcWDO5Y4mO/U9NopTSJduu7YHBHt9fuwrfzLja9X1KJ1xRv/Ts0rqnIqq7r74Vv5+G3x6+XOJgyZYqmTJmivXv3SpLGjh2rmTNnavLkyerSpYtyc3O1du1aRUREaODAgc5v52VnZysqKkqSNGfOHA0fPlw5OTnOcZ999lktXbpU6enpKiwsVO3atdWrVy+NHz9eWVlZGj16tDZs2KAlS5aoT58+bt/OO3DggNq2batu3brpySefVM2aNbVr1y7Nnz9fb7/9tgIDvbz7FVGW38674MuMo1qy8QdJxu0
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjIAAAGwCAYAAACzXI8XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/GU6VOAAAACXBIWXMAAA9hAAAPYQGoP6dpAABLqUlEQVR4nO3dfVwVdfo//tfhHgQO9yDJrRLeJN5DqGkmRa5r+cvM/LRlZdtWaKt2s9Jv07XaoFtL09zM1G68yW01u9FuSDEV71BKswgEBUNuJOBwk4Aw3z+Ik0cOcxg4Z2aO83o+HuexMdecwzU7DueamWveb50gCAKIiIiI7JCD0gkQERERdRcLGSIiIrJbLGSIiIjIbrGQISIiIrvFQoaIiIjsFgsZIiIislssZIiIiMhuOSmdgK21traipKQEXl5e0Ol0SqdDREREXSAIAmpraxEaGgoHh86vu1zxhUxJSQnCwsKUToOIiIi6obi4GH369Ok0fsUXMl5eXgDa/o/w9vZWOBsiIiLqCoPBgLCwMOP3eGeu+EKm/XaSt7c3CxkiIiI7Y6kthM2+REREZLdYyBAREZHdYiFDREREdouFDBEREdktFjJERERkt1jIEBERkd1iIUNERER2i4UMERER2S0WMkRERGS3WMgQERGR3VK0kGlpacHTTz+NqKgouLu7o2/fvnj22WchCIJxHUEQsGjRIvTu3Rvu7u5ISkpCXl6eglm3Kaiow67cchSer1c6FSIiIs1SdK6lF154AW+++SbWr1+PQYMG4ciRI7jvvvug1+vx6KOPAgBefPFFLFu2DOvXr0dUVBSefvppJCcn4+TJk3Bzc5M95+qGJjy6MQd78iqMy8bFBGL5zGHQezjLng8REZGW6YRLL3/I7M9//jOCg4OxZs0a47Jp06bB3d0d77//PgRBQGhoKB577DE8/vjjAICamhoEBwdj3bp1uPPOOy3+DoPBAL1ej5qaGqtMGnnPmkPYl38eLZf83+ao02FMvwC8Ozu+x59PREREXf/+VvTW0ujRo5GRkYGff/4ZAPDdd99h7969mDRpEgCgsLAQpaWlSEpKMr5Hr9cjISEBWVlZZj+zsbERBoPB5GUtBRV12JNXYVLEAECLIGBPXgVvMxEREclM0VtLCxcuhMFgQP/+/eHo6IiWlhb8+9//xl133QUAKC0tBQAEBwebvC84ONgYu1xaWhqWLFlik3zP/NogGj9dWY+ogF42+d1ERETUkaJXZD788EN88MEH2LBhA44ePYr169fj5Zdfxvr167v9mampqaipqTG+iouLrZZvhJ+HaDzSn0UMERGRnBS9IvPEE09g4cKFxl6XwYMH48yZM0hLS8OsWbMQEhICACgrK0Pv3r2N7ysrK8PQoUPNfqarqytcXV1tkm90oCfGxQR22iPDqzFERETyUvSKTENDAxwcTFNwdHREa2srACAqKgohISHIyMgwxg0GAw4ePIjExERZc223fOYwjOkXYLJsTL8ALJ85TJF8iIiItEzRKzJTpkzBv//9b4SHh2PQoEE4duwYXn31Vdx///0AAJ1Oh3nz5uG5555DTEyM8fHr0NBQTJ06VZGc9R7OeHd2PArP1+N0ZT0i/XvxSgwREZFCFC1kli9fjqeffhqPPPIIysvLERoair/97W9YtGiRcZ0nn3wS9fX1ePDBB1FdXY2xY8di586diowhc6moABYwRERESlN0HBk5WHscGSIiIrI9uxhHhoiIiKgnWMgQERGR3WIhQ0RERHaLhQwRERHZLRYyREREZLdYyBAREZHdYiFDREREdouFDBEREdktFjJERERkt1jIEBERkd1iIUNERER2i4UMERER2S0WMkRERGS3WMgQERGR3XJSOgEiIiKyTwUVdTjzawMi/XshKqCXIjmwkCEiIiJJqhua8OjGHOzJqzAuGxcTiOUzh0Hv4SxrLry1RERERJI8ujEH+/LPmyzbl38eczcekz0XFjJERETUZQUVddiTV4EWQTBZ3iII2JNXgcLz9bLmw0KGiIiIuuzMrw2i8dOVLGSIiIhIpSL8PETjkf7yNv2ykCEiIqIuiw70xLiYQDjqdCbLHXU6jIsJlP3pJRYyREREJMnymcMwpl+AybIx/QKwfOYw2XPh49dEREQkid7DGe/Ojkfh+XqcrqznODJERERkf6IClCtg2vHWEhEREdktFjJERERkt1jIEBERkd1ij0w3ZeaWI+dsNYaH++K6mECl0yEiItIkFjISnamsx9QV+1DV0Gxc5uvhjO0pYxHmLz5IEBEREVkXby1JdHkRAwBVDc24ZcVehTIiIiJSRkFFHXbllss+v9KleEVGgszc8g5FTLuqhmZ8m1fB20xERHTFq25owqMbc7Anr8K4bFxMIJbPHAa9h7OsufCKjAQ5Z6tF40eLquRJhIgAqONskEiLHt2Yg335502W7cs/j7kbj8mei6KFTGRkJHQ6XYdXSkoKAODChQtISUmBv78/PD09MW3aNJSVlSmW79A+PqLx4eG+8iRCpHHVDU24Z80h3PBKJu5bexgTXt6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IyJSCgsZIrIrBRV12JNXYTLzNQC0CAL25FWg8Hy9QpkRkRJYyHRTZm45Xs/4Gd9ecmmbiGzvzK8NovHTlSxkiORSUFGHXbnlip5AsEdGojOV9Zi6Yh+qGpqNy3w9nLE9ZSzC/D0UzIxIGyL8xI+zSH82/RLZmpr61HhFRqLLixgAqGpoxi0r9iqUEZG2RAd6YlxMIBx1OpPljjodxsUE8uklIhmoqU+NhYwEmbnlHYqYdlUNzbzNRCST5TOHYUy/AJNlY/oFYPnMYQplRKQdautT460lCXLOVovGjxZV4bqYQHmSIdIwvYcz3p0dj8Lz9ThdWc9xZIhk1JU+NTmPRxYyEgzt4yMaHx7uK08iRAQAiApgAUMkN7X1qfHWkgTjY4NE47waQ0REVzq19amxkJEgM7dcNM4eGSIi0gI19anx1pI
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.plot.scatter(x=\"Age\", y=\"Sex\")\n",
|
|||
|
"\n",
|
|||
|
"df.plot.scatter(x=\"Pclass\", y=\"Age\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Визуализация - Столбчатая диаграмма"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 23,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"<matplotlib.legend.Legend at 0x1e52244d370>"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 23,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAigAAAGrC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ZT8/f01f/58BQQEaN26dW7brVixQkFBQbp8+bJru3379qmkpER16tTR/Pnz3cb/9a9/lZeXl3744QdJUl5env7lX/5FtWvXltVqVbdu3bR//363baZPn66wsDAFBQVp+PDhKigouO2fIQDAbPwz1iDe3t76j//4Dw0dOlSvvfaa6tSpc9OYzMxMPf/885oyZYoGDRqkXbt2afTo0apZs6YSExP1pz/9Sa1bt9bIkSM1YsSIWz7WZ599ppkzZ2rp0qVq3ry5srOzb3rTvxu//e1v9d5776lt27by9/fX9u3blZaWpvj4eNeYJUuWqG/fvjd9N42Xl5eGDBmitLQ0jRo1ym18p06dVLduXUnSc8895wofm82m//qv/1L37t115MgRhYSE6NNPP9WUKVM0d+5cde7cWR9//LFmz56tBg0alPn5APCAB3l94L3iusIHjiMohunXr5/atGmjyZMnl7r+/fffV/fu3TVx4kQ1btxYiYmJGjt2rP7zP/9TkhQSEiJvb28FBQXJbrfLbreXup+srCzZ7XbFxsYqKipKjz322G2D5lbGjRun/v37q379+goPD1dCQoJWrlypy5cvS5IcDoe++OILJSQklLp9QkKCdu7cqaysLElSSUmJli5d6hq/Y8cOffXVV1q+fLmio6P1yCOP6N1331VwcLD++Mc/SpJmzZql4cOHa/jw4Xr00Uf19ttvq1mzZmV+LgAAcxAoBnrnnXe0aNEiHTx48KZ1Bw8eVKdOndzu69Spk44ePari4uK7foznnntOV65cUYMGDTRixAitWLFC165dK/Nco6Pd/1XRq1cvVatWTatWrZJ0/UiN1WpVbGxsqdu3adNGTZs2VVpamiQpPT1dubm5eu655yRJ+/fv18WLF1WzZk3VqFHDtZw4cULHjx+XdP3PpGPHjm77jYmJKfNzAQCYg0AxUJcuXRQXF6fk5OQKe4zIyEgdPnxY8+bNU0BAgEaPHq0uXbq4LnS1WCxyOp1u25R2EWz16tXdbvv6+mrgwIGu4EhLS9OgQYNue1FsQkKC2/iePXu6fkfp4sWLCg8P1759+9yWw4cP64033rj3PwAAgNEIFENNnz5dq1evVkZGhtv9TZs21c6dO93u27lzpxo3buz60TtfX9+7OpoSEBCg3r17a/bs2dq6dasyMjL07bffSpJq166tM2fOuMYePXrUddrmThISErR+/XodOHBAmzdvvuXpnRuGDh2q7777TpmZmfrjH//oNr5du3bKzs6Wj4+PGjVq5LbUqlXL9WeyZ88et33u3r37ruYKADATF8kaqmXLlkpISNDs2bPd7n/99dfVoUMHTZs2TYMGDVJGRobmzJmjefPmucbUq1dP27Zt0+DBg+Xn5+d6I/9HqampKi4uVseOHRUYGKjFixcrICDAdWFqt27dNGfOHMXExKi4uFi/+c1vVK1atbuae5cuXWS325WQkKD69evfdPrln9WrV09PPPGEhg8fruLiYj377LOudbGxsYqJiVHfvn01Y8YMNW7cWKdPn9YXX3yhfv36KTo6Wr/61a+UmJio6OhoderUSUuWLNGBAwe4SBYAKrGHK1Aq2VXYU6dO1bJly9zua9eunT799FNNmjRJ06ZNU3h4uKZOnarExES37f71X/9VDRs2VGFh4U2naqTrHxmePn26kpKSVFxcrJYtW2r16tWuUyvvvfeeXnrpJT355JOKiIjQ73//e2VmZt7VvC0Wi4YMGaIZM2Zo0qRJd7VNQkKCRo8erRdffFEBAQFu+1q7dq3+/d//XS+99JLOnj0ru92uLl26KCwsTJI0aNAgHT9+XBMmTFBBQYEGDBigUaNG6csvv7yrxwYAmMfiLO3dy3AOh0M2m035+fmyWq1u6woKCnTixAnVr19f/v7+HpohTMfrBDAIHzN+aNzu/fufcQ0KAAAwDoECAACMQ6AAAADjECgAAMA4BAoAADAOgQIAAIxDoAAAAOMQKAAAwDgECrR161ZZLBbl5eVV6OMkJiaqb9++FfoYAICq4aH6qnvLW5YH9ljOyWX/gt6zZ89q0qRJ+uKLL5STk6Of/exnat26tSZNmqROnTpVwCyve+KJJ3TmzBnZbLYKewwAAMrioQoU0w0YMEBXr17VokWL1KBBA+Xk5GjTpk06d+7cPe3P6XSquLhYPj63/2v29fWV3W6/p8cAAKAicIrHEHl5edq+fbveeecdPf3006pbt64ee+wxJScn69lnn9XJkydlsVi0b98+t20sFou2bt0q6e+natatW6f27dvLz89PH374oSwWiw4dOuT2eDNnzlTDhg3dtsvLy5PD4VBAQIDWrVvnNn7FihUKCgrS5cuXJUmnTp3S888/r+DgYIWEhKhPnz46efKka3xxcbGSkpIUHBysmjVrasKECaX+aCEAAKUhUAxRo0YN1ahRQytXrlRhYeF97eu3v/2tpk+froMHD2rgwIGKjo7WkiVL3MYsWbJEQ4cOvWlbq9WqX/ziF0pLS7tpfN++fRUYGKiioiLFxcUpKChI27dv186dO1WjRg317NlTV69elXT915BTU1P14YcfaseOHTp//rxWrFhxX88LAPDwIFAM4ePjo9TUVC1atEjBwcHq1KmT/u3f/k3ffPNNmfc1depU/fznP1fDhg0VEhKihIQEffLJJ671R44cUWZmphISEkrdPiEhQStXrnQdLXE4HPriiy9c45ctW6aSkhL9z//8j1q2bKmmTZtq4cKFysrKch3NmTVrlpKTk9W/f381bdpUCxYs4BoXAMBdK1OgpKSkqEOHDgoKClJoaKj69u2rw4cPu43p2rWrLBaL2/LKK6+4jcnKytIzzzyjwMBAhYaG6o033tC1a9fu/9lUcgMGDNDp06e1atUq9ezZU1u3blW7du2Umppapv1ER7v/LPjgwYN18uRJ7d69W9L
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"plot = data.groupby([\"Pclass\", \"Survived\"]).size().unstack().plot.bar(color=[\"pink\", \"green\"])\n",
|
|||
|
"plot.legend([\"Not survived\", \"Survived\"])"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Визуализация - Временные ряды"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 24,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"<class 'pandas.core.frame.DataFrame'>\n",
|
|||
|
"RangeIndex: 243 entries, 0 to 242\n",
|
|||
|
"Data columns (total 6 columns):\n",
|
|||
|
" # Column Non-Null Count Dtype \n",
|
|||
|
"--- ------ -------------- ----- \n",
|
|||
|
" 0 my_date 243 non-null object \n",
|
|||
|
" 1 my_value 243 non-null float64 \n",
|
|||
|
" 2 bullet 2 non-null object \n",
|
|||
|
" 3 bulletClass 2 non-null object \n",
|
|||
|
" 4 label 2 non-null object \n",
|
|||
|
" 5 date 243 non-null datetime64[ns]\n",
|
|||
|
"dtypes: datetime64[ns](1), float64(1), object(4)\n",
|
|||
|
"memory usage: 11.5+ KB\n",
|
|||
|
" my_date my_value bullet bulletClass label date\n",
|
|||
|
"0 28.03.2023 76.5662 NaN NaN NaN 2023-03-28\n",
|
|||
|
"1 31.03.2023 77.0863 NaN NaN NaN 2023-03-31\n",
|
|||
|
"2 01.04.2023 77.3233 NaN NaN NaN 2023-04-01\n",
|
|||
|
"3 04.04.2023 77.9510 NaN NaN NaN 2023-04-04\n",
|
|||
|
"4 05.04.2023 79.3563 NaN NaN NaN 2023-04-05\n",
|
|||
|
".. ... ... ... ... ... ...\n",
|
|||
|
"238 20.03.2024 92.2243 NaN NaN NaN 2024-03-20\n",
|
|||
|
"239 21.03.2024 92.6861 NaN NaN NaN 2024-03-21\n",
|
|||
|
"240 22.03.2024 91.9499 NaN NaN NaN 2024-03-22\n",
|
|||
|
"241 23.03.2024 92.6118 NaN NaN NaN 2024-03-23\n",
|
|||
|
"242 26.03.2024 92.7761 NaN NaN NaN 2024-03-26\n",
|
|||
|
"\n",
|
|||
|
"[243 rows x 6 columns]\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAigAAAHGCAYAAABeq3DqAAAAOXRFWHRTb2Z0d2FyZQBNYXR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CQkJVl+rO5S5vZCcoEyYMAETJkyw+hoR4a233sLzzz+PyZMnAwA+//xzBAcHY8OGDbjnnntw5swZbNmyBYcPH8ZNN90EAHj33Xdx22234Y033kBYWFgz/jmMtR+ZteZAAdr3KB5TghLheyNBqd1J1mAgKBQ8F4qcSVkDpy3y9PQUZ4R1dva6lnYdxZOWloasrCyMHj1afM7b2xsJCQnYv38/AGD//v3w8fERkxPA2LFHoVDg4MGDVo9bUVEBnU5n9sdYe3e11iyyQPutQSmtqEZeTTNOlH/tBMVYg/L5/ku4/xPr9xbW+ky1A2VlZa0cCbMX07Vsbs2PXTvJZmVlAYBFx5/g4GDxtaysLAQFBZkHoVLBz89P3Kau5cuXY+nSpfYMlTGnZ1mD0j4TlIwC483Q21VttlhisNeNWS73peS1eFysaZRKJXx8fJCTkwMAcHNz45l/nRQRoaysDDk5OfDx8YFSKW3ZgLqcYhTPokWL8PTTT4uPdTodIiMjWzEixlof16AYZeRbdpAFgDHdgvHXWzrivd+Ny83rDQQlN/PIUkhICACISQpzbj4+PuI1bQ67JiimgLKzsxEaGio+n52djT59+ojb1H0TVldXIz8/v95/kEajgUajsWeojDk90zo8GpUCFdWGdtsHJd1KB1kA0KqVePyWeDFBKa/Sw51nlJUlQRAQGhqKoKAgi7VgmHNRq9XNrjkxseunNTY2FiE
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"from datetime import datetime\n",
|
|||
|
"import matplotlib.dates as md\n",
|
|||
|
"\n",
|
|||
|
"ts = pd.read_csv(\"data/dollar.csv\")\n",
|
|||
|
"ts[\"date\"] = ts.apply(lambda row: datetime.strptime(row[\"my_date\"], \"%d.%m.%Y\"), axis=1)\n",
|
|||
|
"ts.info()\n",
|
|||
|
"\n",
|
|||
|
"print(ts)\n",
|
|||
|
"\n",
|
|||
|
"plot = ts.plot.line(x=\"date\", y=\"my_value\")\n",
|
|||
|
"plot.xaxis.set_major_locator(md.DayLocator(interval=10))\n",
|
|||
|
"plot.xaxis.set_major_formatter(md.DateFormatter(\"%d.%m.%Y\"))\n",
|
|||
|
"plot.tick_params(axis=\"x\", labelrotation=90)"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"metadata": {
|
|||
|
"kernelspec": {
|
|||
|
"display_name": ".venv",
|
|||
|
"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.7"
|
|||
|
}
|
|||
|
},
|
|||
|
"nbformat": 4,
|
|||
|
"nbformat_minor": 2
|
|||
|
}
|