2225 lines
511 KiB
Plaintext
2225 lines
511 KiB
Plaintext
|
{
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"# Лабораторная работа №1"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Датасет 12. Цены на акции Starbucks."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"1) Загрузка и сохранение данных"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 22,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"import pandas as pd"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 62,
|
|||
|
"metadata": {},
|
|||
|
"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>Date</th>\n",
|
|||
|
" <th>Open</th>\n",
|
|||
|
" <th>High</th>\n",
|
|||
|
" <th>Low</th>\n",
|
|||
|
" <th>Close</th>\n",
|
|||
|
" <th>Adj Close</th>\n",
|
|||
|
" <th>Volume</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0</th>\n",
|
|||
|
" <td>1992-06-26</td>\n",
|
|||
|
" <td>0.328125</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.320313</td>\n",
|
|||
|
" <td>0.335938</td>\n",
|
|||
|
" <td>0.260703</td>\n",
|
|||
|
" <td>224358400</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>1992-06-29</td>\n",
|
|||
|
" <td>0.339844</td>\n",
|
|||
|
" <td>0.367188</td>\n",
|
|||
|
" <td>0.332031</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.278891</td>\n",
|
|||
|
" <td>58732800</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>1992-06-30</td>\n",
|
|||
|
" <td>0.367188</td>\n",
|
|||
|
" <td>0.371094</td>\n",
|
|||
|
" <td>0.343750</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.269797</td>\n",
|
|||
|
" <td>34777600</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <td>1992-07-01</td>\n",
|
|||
|
" <td>0.351563</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.339844</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.275860</td>\n",
|
|||
|
" <td>18316800</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>1992-07-02</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.275860</td>\n",
|
|||
|
" <td>13996800</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Date Open High Low Close Adj Close Volume\n",
|
|||
|
"0 1992-06-26 0.328125 0.347656 0.320313 0.335938 0.260703 224358400\n",
|
|||
|
"1 1992-06-29 0.339844 0.367188 0.332031 0.359375 0.278891 58732800\n",
|
|||
|
"2 1992-06-30 0.367188 0.371094 0.343750 0.347656 0.269797 34777600\n",
|
|||
|
"3 1992-07-01 0.351563 0.359375 0.339844 0.355469 0.275860 18316800\n",
|
|||
|
"4 1992-07-02 0.359375 0.359375 0.347656 0.355469 0.275860 13996800"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 62,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df = pd.read_csv(\"coffee.csv\")\n",
|
|||
|
"\n",
|
|||
|
"df.head()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 63,
|
|||
|
"metadata": {},
|
|||
|
"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>Date</th>\n",
|
|||
|
" <th>Open</th>\n",
|
|||
|
" <th>High</th>\n",
|
|||
|
" <th>Low</th>\n",
|
|||
|
" <th>Close</th>\n",
|
|||
|
" <th>Adj Close</th>\n",
|
|||
|
" <th>Volume</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8034</th>\n",
|
|||
|
" <td>2024-05-22</td>\n",
|
|||
|
" <td>77.699997</td>\n",
|
|||
|
" <td>81.019997</td>\n",
|
|||
|
" <td>77.440002</td>\n",
|
|||
|
" <td>80.720001</td>\n",
|
|||
|
" <td>80.720001</td>\n",
|
|||
|
" <td>22063400</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8035</th>\n",
|
|||
|
" <td>2024-05-23</td>\n",
|
|||
|
" <td>80.099998</td>\n",
|
|||
|
" <td>80.699997</td>\n",
|
|||
|
" <td>79.169998</td>\n",
|
|||
|
" <td>79.260002</td>\n",
|
|||
|
" <td>79.260002</td>\n",
|
|||
|
" <td>4651418</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Date Open High Low Close Adj Close \\\n",
|
|||
|
"8034 2024-05-22 77.699997 81.019997 77.440002 80.720001 80.720001 \n",
|
|||
|
"8035 2024-05-23 80.099998 80.699997 79.169998 79.260002 79.260002 \n",
|
|||
|
"\n",
|
|||
|
" Volume \n",
|
|||
|
"8034 22063400 \n",
|
|||
|
"8035 4651418 "
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 63,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.tail(2)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 24,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df.to_csv(\"newCoffee.csv\", index=False)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"2) Получение сведений о датафрейме с данными"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 25,
|
|||
|
"metadata": {},
|
|||
|
"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>Open</th>\n",
|
|||
|
" <th>High</th>\n",
|
|||
|
" <th>Low</th>\n",
|
|||
|
" <th>Close</th>\n",
|
|||
|
" <th>Adj Close</th>\n",
|
|||
|
" <th>Volume</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>count</th>\n",
|
|||
|
" <td>8036.000000</td>\n",
|
|||
|
" <td>8036.000000</td>\n",
|
|||
|
" <td>8036.000000</td>\n",
|
|||
|
" <td>8036.000000</td>\n",
|
|||
|
" <td>8036.000000</td>\n",
|
|||
|
" <td>8.036000e+03</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>mean</th>\n",
|
|||
|
" <td>30.054280</td>\n",
|
|||
|
" <td>30.351487</td>\n",
|
|||
|
" <td>29.751322</td>\n",
|
|||
|
" <td>30.058857</td>\n",
|
|||
|
" <td>26.674025</td>\n",
|
|||
|
" <td>1.470459e+07</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>std</th>\n",
|
|||
|
" <td>33.615577</td>\n",
|
|||
|
" <td>33.906613</td>\n",
|
|||
|
" <td>33.314569</td>\n",
|
|||
|
" <td>33.615911</td>\n",
|
|||
|
" <td>31.728090</td>\n",
|
|||
|
" <td>1.340021e+07</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>min</th>\n",
|
|||
|
" <td>0.328125</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.320313</td>\n",
|
|||
|
" <td>0.335938</td>\n",
|
|||
|
" <td>0.260703</td>\n",
|
|||
|
" <td>1.504000e+06</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>25%</th>\n",
|
|||
|
" <td>4.392031</td>\n",
|
|||
|
" <td>4.531250</td>\n",
|
|||
|
" <td>4.304922</td>\n",
|
|||
|
" <td>4.399610</td>\n",
|
|||
|
" <td>3.414300</td>\n",
|
|||
|
" <td>7.817750e+06</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>50%</th>\n",
|
|||
|
" <td>13.325000</td>\n",
|
|||
|
" <td>13.493750</td>\n",
|
|||
|
" <td>13.150000</td>\n",
|
|||
|
" <td>13.330000</td>\n",
|
|||
|
" <td>10.352452</td>\n",
|
|||
|
" <td>1.169815e+07</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>75%</th>\n",
|
|||
|
" <td>55.250000</td>\n",
|
|||
|
" <td>55.722501</td>\n",
|
|||
|
" <td>54.852499</td>\n",
|
|||
|
" <td>55.267499</td>\n",
|
|||
|
" <td>47.464829</td>\n",
|
|||
|
" <td>1.778795e+07</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>max</th>\n",
|
|||
|
" <td>126.080002</td>\n",
|
|||
|
" <td>126.320000</td>\n",
|
|||
|
" <td>124.809998</td>\n",
|
|||
|
" <td>126.059998</td>\n",
|
|||
|
" <td>118.010414</td>\n",
|
|||
|
" <td>5.855088e+08</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Open High Low Close Adj Close \\\n",
|
|||
|
"count 8036.000000 8036.000000 8036.000000 8036.000000 8036.000000 \n",
|
|||
|
"mean 30.054280 30.351487 29.751322 30.058857 26.674025 \n",
|
|||
|
"std 33.615577 33.906613 33.314569 33.615911 31.728090 \n",
|
|||
|
"min 0.328125 0.347656 0.320313 0.335938 0.260703 \n",
|
|||
|
"25% 4.392031 4.531250 4.304922 4.399610 3.414300 \n",
|
|||
|
"50% 13.325000 13.493750 13.150000 13.330000 10.352452 \n",
|
|||
|
"75% 55.250000 55.722501 54.852499 55.267499 47.464829 \n",
|
|||
|
"max 126.080002 126.320000 124.809998 126.059998 118.010414 \n",
|
|||
|
"\n",
|
|||
|
" Volume \n",
|
|||
|
"count 8.036000e+03 \n",
|
|||
|
"mean 1.470459e+07 \n",
|
|||
|
"std 1.340021e+07 \n",
|
|||
|
"min 1.504000e+06 \n",
|
|||
|
"25% 7.817750e+06 \n",
|
|||
|
"50% 1.169815e+07 \n",
|
|||
|
"75% 1.778795e+07 \n",
|
|||
|
"max 5.855088e+08 "
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 25,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.describe()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 26,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"<class 'pandas.core.frame.DataFrame'>\n",
|
|||
|
"RangeIndex: 8036 entries, 0 to 8035\n",
|
|||
|
"Data columns (total 7 columns):\n",
|
|||
|
" # Column Non-Null Count Dtype \n",
|
|||
|
"--- ------ -------------- ----- \n",
|
|||
|
" 0 Date 8036 non-null object \n",
|
|||
|
" 1 Open 8036 non-null float64\n",
|
|||
|
" 2 High 8036 non-null float64\n",
|
|||
|
" 3 Low 8036 non-null float64\n",
|
|||
|
" 4 Close 8036 non-null float64\n",
|
|||
|
" 5 Adj Close 8036 non-null float64\n",
|
|||
|
" 6 Volume 8036 non-null int64 \n",
|
|||
|
"dtypes: float64(5), int64(1), object(1)\n",
|
|||
|
"memory usage: 439.6+ KB\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.info()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"3. Получение сведений о колонках датафрейма"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 27,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"Index(['Date', 'Open', 'High', 'Low', 'Close', 'Adj Close', 'Volume'], dtype='object')"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 27,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.columns"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"4. Вывод отдельных строк и столбцов из датафрейма"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 28,
|
|||
|
"metadata": {},
|
|||
|
"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>Open</th>\n",
|
|||
|
" <th>Close</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0</th>\n",
|
|||
|
" <td>0.328125</td>\n",
|
|||
|
" <td>0.335938</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>0.339844</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>0.367188</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <td>0.351563</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8031</th>\n",
|
|||
|
" <td>75.269997</td>\n",
|
|||
|
" <td>77.849998</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8032</th>\n",
|
|||
|
" <td>77.680000</td>\n",
|
|||
|
" <td>77.540001</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8033</th>\n",
|
|||
|
" <td>77.559998</td>\n",
|
|||
|
" <td>77.720001</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8034</th>\n",
|
|||
|
" <td>77.699997</td>\n",
|
|||
|
" <td>80.720001</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8035</th>\n",
|
|||
|
" <td>80.099998</td>\n",
|
|||
|
" <td>79.260002</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>8036 rows × 2 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Open Close\n",
|
|||
|
"0 0.328125 0.335938\n",
|
|||
|
"1 0.339844 0.359375\n",
|
|||
|
"2 0.367188 0.347656\n",
|
|||
|
"3 0.351563 0.355469\n",
|
|||
|
"4 0.359375 0.355469\n",
|
|||
|
"... ... ...\n",
|
|||
|
"8031 75.269997 77.849998\n",
|
|||
|
"8032 77.680000 77.540001\n",
|
|||
|
"8033 77.559998 77.720001\n",
|
|||
|
"8034 77.699997 80.720001\n",
|
|||
|
"8035 80.099998 79.260002\n",
|
|||
|
"\n",
|
|||
|
"[8036 rows x 2 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 28,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[[\"Open\", \"Close\"]]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 29,
|
|||
|
"metadata": {},
|
|||
|
"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>Date</th>\n",
|
|||
|
" <th>Open</th>\n",
|
|||
|
" <th>High</th>\n",
|
|||
|
" <th>Low</th>\n",
|
|||
|
" <th>Close</th>\n",
|
|||
|
" <th>Adj Close</th>\n",
|
|||
|
" <th>Volume</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <td>1992-07-06</td>\n",
|
|||
|
" <td>0.351563</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.275860</td>\n",
|
|||
|
" <td>5753600</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>6</th>\n",
|
|||
|
" <td>1992-07-07</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.275860</td>\n",
|
|||
|
" <td>10662400</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>7</th>\n",
|
|||
|
" <td>1992-07-08</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.343750</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.269797</td>\n",
|
|||
|
" <td>15500800</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8</th>\n",
|
|||
|
" <td>1992-07-09</td>\n",
|
|||
|
" <td>0.351563</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.278891</td>\n",
|
|||
|
" <td>3923200</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>9</th>\n",
|
|||
|
" <td>1992-07-10</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.367188</td>\n",
|
|||
|
" <td>0.351563</td>\n",
|
|||
|
" <td>0.363281</td>\n",
|
|||
|
" <td>0.281923</td>\n",
|
|||
|
" <td>11040000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Date Open High Low Close Adj Close Volume\n",
|
|||
|
"5 1992-07-06 0.351563 0.355469 0.347656 0.355469 0.275860 5753600\n",
|
|||
|
"6 1992-07-07 0.355469 0.355469 0.347656 0.355469 0.275860 10662400\n",
|
|||
|
"7 1992-07-08 0.355469 0.355469 0.343750 0.347656 0.269797 15500800\n",
|
|||
|
"8 1992-07-09 0.351563 0.359375 0.347656 0.359375 0.278891 3923200\n",
|
|||
|
"9 1992-07-10 0.359375 0.367188 0.351563 0.363281 0.281923 11040000"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 29,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.iloc[5:10]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 30,
|
|||
|
"metadata": {},
|
|||
|
"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>Date</th>\n",
|
|||
|
" <th>Open</th>\n",
|
|||
|
" <th>High</th>\n",
|
|||
|
" <th>Low</th>\n",
|
|||
|
" <th>Close</th>\n",
|
|||
|
" <th>Adj Close</th>\n",
|
|||
|
" <th>Volume</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>7322</th>\n",
|
|||
|
" <td>2021-07-23</td>\n",
|
|||
|
" <td>124.550003</td>\n",
|
|||
|
" <td>126.320000</td>\n",
|
|||
|
" <td>123.919998</td>\n",
|
|||
|
" <td>125.970001</td>\n",
|
|||
|
" <td>117.926170</td>\n",
|
|||
|
" <td>7934200</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>7323</th>\n",
|
|||
|
" <td>2021-07-26</td>\n",
|
|||
|
" <td>125.739998</td>\n",
|
|||
|
" <td>126.099998</td>\n",
|
|||
|
" <td>124.250000</td>\n",
|
|||
|
" <td>126.059998</td>\n",
|
|||
|
" <td>118.010414</td>\n",
|
|||
|
" <td>4827500</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>7324</th>\n",
|
|||
|
" <td>2021-07-27</td>\n",
|
|||
|
" <td>126.080002</td>\n",
|
|||
|
" <td>126.160004</td>\n",
|
|||
|
" <td>124.809998</td>\n",
|
|||
|
" <td>126.029999</td>\n",
|
|||
|
" <td>117.982330</td>\n",
|
|||
|
" <td>6110900</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>7325</th>\n",
|
|||
|
" <td>2021-07-28</td>\n",
|
|||
|
" <td>122.559998</td>\n",
|
|||
|
" <td>123.330002</td>\n",
|
|||
|
" <td>121.389999</td>\n",
|
|||
|
" <td>122.410004</td>\n",
|
|||
|
" <td>114.593483</td>\n",
|
|||
|
" <td>11747000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>7326</th>\n",
|
|||
|
" <td>2021-07-29</td>\n",
|
|||
|
" <td>122.930000</td>\n",
|
|||
|
" <td>123.470001</td>\n",
|
|||
|
" <td>122.139999</td>\n",
|
|||
|
" <td>122.379997</td>\n",
|
|||
|
" <td>114.565414</td>\n",
|
|||
|
" <td>6618400</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>7327</th>\n",
|
|||
|
" <td>2021-07-30</td>\n",
|
|||
|
" <td>122.190002</td>\n",
|
|||
|
" <td>122.980003</td>\n",
|
|||
|
" <td>121.099998</td>\n",
|
|||
|
" <td>121.430000</td>\n",
|
|||
|
" <td>113.676071</td>\n",
|
|||
|
" <td>5712300</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>7328</th>\n",
|
|||
|
" <td>2021-08-02</td>\n",
|
|||
|
" <td>122.029999</td>\n",
|
|||
|
" <td>122.980003</td>\n",
|
|||
|
" <td>120.070000</td>\n",
|
|||
|
" <td>120.370003</td>\n",
|
|||
|
" <td>112.683769</td>\n",
|
|||
|
" <td>5996800</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>7329</th>\n",
|
|||
|
" <td>2021-08-03</td>\n",
|
|||
|
" <td>120.570000</td>\n",
|
|||
|
" <td>120.750000</td>\n",
|
|||
|
" <td>117.519997</td>\n",
|
|||
|
" <td>119.129997</td>\n",
|
|||
|
" <td>111.522942</td>\n",
|
|||
|
" <td>6030500</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Date Open High Low Close Adj Close \\\n",
|
|||
|
"7322 2021-07-23 124.550003 126.320000 123.919998 125.970001 117.926170 \n",
|
|||
|
"7323 2021-07-26 125.739998 126.099998 124.250000 126.059998 118.010414 \n",
|
|||
|
"7324 2021-07-27 126.080002 126.160004 124.809998 126.029999 117.982330 \n",
|
|||
|
"7325 2021-07-28 122.559998 123.330002 121.389999 122.410004 114.593483 \n",
|
|||
|
"7326 2021-07-29 122.930000 123.470001 122.139999 122.379997 114.565414 \n",
|
|||
|
"7327 2021-07-30 122.190002 122.980003 121.099998 121.430000 113.676071 \n",
|
|||
|
"7328 2021-08-02 122.029999 122.980003 120.070000 120.370003 112.683769 \n",
|
|||
|
"7329 2021-08-03 120.570000 120.750000 117.519997 119.129997 111.522942 \n",
|
|||
|
"\n",
|
|||
|
" Volume \n",
|
|||
|
"7322 7934200 \n",
|
|||
|
"7323 4827500 \n",
|
|||
|
"7324 6110900 \n",
|
|||
|
"7325 11747000 \n",
|
|||
|
"7326 6618400 \n",
|
|||
|
"7327 5712300 \n",
|
|||
|
"7328 5996800 \n",
|
|||
|
"7329 6030500 "
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 30,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[df['Open'] > 120]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"5. Группировка и агрегация данных в датафрейме"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 31,
|
|||
|
"metadata": {},
|
|||
|
"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>Low</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>High</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0.347656</th>\n",
|
|||
|
" <td>0.320313</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0.355469</th>\n",
|
|||
|
" <td>0.346354</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0.359375</th>\n",
|
|||
|
" <td>0.345052</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0.367188</th>\n",
|
|||
|
" <td>0.341797</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0.371094</th>\n",
|
|||
|
" <td>0.351562</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>123.330002</th>\n",
|
|||
|
" <td>121.389999</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>123.470001</th>\n",
|
|||
|
" <td>122.139999</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>126.099998</th>\n",
|
|||
|
" <td>124.250000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>126.160004</th>\n",
|
|||
|
" <td>124.809998</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>126.320000</th>\n",
|
|||
|
" <td>123.919998</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>5245 rows × 1 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Low\n",
|
|||
|
"High \n",
|
|||
|
"0.347656 0.320313\n",
|
|||
|
"0.355469 0.346354\n",
|
|||
|
"0.359375 0.345052\n",
|
|||
|
"0.367188 0.341797\n",
|
|||
|
"0.371094 0.351562\n",
|
|||
|
"... ...\n",
|
|||
|
"123.330002 121.389999\n",
|
|||
|
"123.470001 122.139999\n",
|
|||
|
"126.099998 124.250000\n",
|
|||
|
"126.160004 124.809998\n",
|
|||
|
"126.320000 123.919998\n",
|
|||
|
"\n",
|
|||
|
"[5245 rows x 1 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 31,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"group = df.groupby(['High'])['Low'].mean()\n",
|
|||
|
"group.to_frame()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"6. Сортировка данных в датафрейме"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 32,
|
|||
|
"metadata": {},
|
|||
|
"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>Date</th>\n",
|
|||
|
" <th>Open</th>\n",
|
|||
|
" <th>High</th>\n",
|
|||
|
" <th>Low</th>\n",
|
|||
|
" <th>Close</th>\n",
|
|||
|
" <th>Adj Close</th>\n",
|
|||
|
" <th>Volume</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0</th>\n",
|
|||
|
" <td>1992-06-26</td>\n",
|
|||
|
" <td>0.328125</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.320313</td>\n",
|
|||
|
" <td>0.335938</td>\n",
|
|||
|
" <td>0.260703</td>\n",
|
|||
|
" <td>224358400</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>1992-06-29</td>\n",
|
|||
|
" <td>0.339844</td>\n",
|
|||
|
" <td>0.367188</td>\n",
|
|||
|
" <td>0.332031</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.278891</td>\n",
|
|||
|
" <td>58732800</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>1992-06-30</td>\n",
|
|||
|
" <td>0.367188</td>\n",
|
|||
|
" <td>0.371094</td>\n",
|
|||
|
" <td>0.343750</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.269797</td>\n",
|
|||
|
" <td>34777600</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <td>1992-07-01</td>\n",
|
|||
|
" <td>0.351563</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.339844</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.275860</td>\n",
|
|||
|
" <td>18316800</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>1992-07-02</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.275860</td>\n",
|
|||
|
" <td>13996800</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8031</th>\n",
|
|||
|
" <td>2024-05-17</td>\n",
|
|||
|
" <td>75.269997</td>\n",
|
|||
|
" <td>78.000000</td>\n",
|
|||
|
" <td>74.919998</td>\n",
|
|||
|
" <td>77.849998</td>\n",
|
|||
|
" <td>77.849998</td>\n",
|
|||
|
" <td>14436500</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8032</th>\n",
|
|||
|
" <td>2024-05-20</td>\n",
|
|||
|
" <td>77.680000</td>\n",
|
|||
|
" <td>78.320000</td>\n",
|
|||
|
" <td>76.709999</td>\n",
|
|||
|
" <td>77.540001</td>\n",
|
|||
|
" <td>77.540001</td>\n",
|
|||
|
" <td>11183800</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8033</th>\n",
|
|||
|
" <td>2024-05-21</td>\n",
|
|||
|
" <td>77.559998</td>\n",
|
|||
|
" <td>78.220001</td>\n",
|
|||
|
" <td>77.500000</td>\n",
|
|||
|
" <td>77.720001</td>\n",
|
|||
|
" <td>77.720001</td>\n",
|
|||
|
" <td>8916600</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8034</th>\n",
|
|||
|
" <td>2024-05-22</td>\n",
|
|||
|
" <td>77.699997</td>\n",
|
|||
|
" <td>81.019997</td>\n",
|
|||
|
" <td>77.440002</td>\n",
|
|||
|
" <td>80.720001</td>\n",
|
|||
|
" <td>80.720001</td>\n",
|
|||
|
" <td>22063400</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8035</th>\n",
|
|||
|
" <td>2024-05-23</td>\n",
|
|||
|
" <td>80.099998</td>\n",
|
|||
|
" <td>80.699997</td>\n",
|
|||
|
" <td>79.169998</td>\n",
|
|||
|
" <td>79.260002</td>\n",
|
|||
|
" <td>79.260002</td>\n",
|
|||
|
" <td>4651418</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>8036 rows × 7 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Date Open High Low Close Adj Close \\\n",
|
|||
|
"0 1992-06-26 0.328125 0.347656 0.320313 0.335938 0.260703 \n",
|
|||
|
"1 1992-06-29 0.339844 0.367188 0.332031 0.359375 0.278891 \n",
|
|||
|
"2 1992-06-30 0.367188 0.371094 0.343750 0.347656 0.269797 \n",
|
|||
|
"3 1992-07-01 0.351563 0.359375 0.339844 0.355469 0.275860 \n",
|
|||
|
"4 1992-07-02 0.359375 0.359375 0.347656 0.355469 0.275860 \n",
|
|||
|
"... ... ... ... ... ... ... \n",
|
|||
|
"8031 2024-05-17 75.269997 78.000000 74.919998 77.849998 77.849998 \n",
|
|||
|
"8032 2024-05-20 77.680000 78.320000 76.709999 77.540001 77.540001 \n",
|
|||
|
"8033 2024-05-21 77.559998 78.220001 77.500000 77.720001 77.720001 \n",
|
|||
|
"8034 2024-05-22 77.699997 81.019997 77.440002 80.720001 80.720001 \n",
|
|||
|
"8035 2024-05-23 80.099998 80.699997 79.169998 79.260002 79.260002 \n",
|
|||
|
"\n",
|
|||
|
" Volume \n",
|
|||
|
"0 224358400 \n",
|
|||
|
"1 58732800 \n",
|
|||
|
"2 34777600 \n",
|
|||
|
"3 18316800 \n",
|
|||
|
"4 13996800 \n",
|
|||
|
"... ... \n",
|
|||
|
"8031 14436500 \n",
|
|||
|
"8032 11183800 \n",
|
|||
|
"8033 8916600 \n",
|
|||
|
"8034 22063400 \n",
|
|||
|
"8035 4651418 \n",
|
|||
|
"\n",
|
|||
|
"[8036 rows x 7 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 32,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sorted_df = df.sort_values(by='Date', ascending = True)\n",
|
|||
|
"sorted_df"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"7. Удаление строк/столбцов"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 33,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df_dropped_columns = df.drop(columns=['Adj Close', 'Volume']) # Удаление столбцов 'Adj Close' и 'Volume'"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 34,
|
|||
|
"metadata": {},
|
|||
|
"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>Date</th>\n",
|
|||
|
" <th>Open</th>\n",
|
|||
|
" <th>High</th>\n",
|
|||
|
" <th>Low</th>\n",
|
|||
|
" <th>Close</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0</th>\n",
|
|||
|
" <td>1992-06-26</td>\n",
|
|||
|
" <td>0.328125</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.320313</td>\n",
|
|||
|
" <td>0.335938</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>1992-06-29</td>\n",
|
|||
|
" <td>0.339844</td>\n",
|
|||
|
" <td>0.367188</td>\n",
|
|||
|
" <td>0.332031</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>1992-06-30</td>\n",
|
|||
|
" <td>0.367188</td>\n",
|
|||
|
" <td>0.371094</td>\n",
|
|||
|
" <td>0.343750</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <td>1992-07-01</td>\n",
|
|||
|
" <td>0.351563</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.339844</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>1992-07-02</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8031</th>\n",
|
|||
|
" <td>2024-05-17</td>\n",
|
|||
|
" <td>75.269997</td>\n",
|
|||
|
" <td>78.000000</td>\n",
|
|||
|
" <td>74.919998</td>\n",
|
|||
|
" <td>77.849998</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8032</th>\n",
|
|||
|
" <td>2024-05-20</td>\n",
|
|||
|
" <td>77.680000</td>\n",
|
|||
|
" <td>78.320000</td>\n",
|
|||
|
" <td>76.709999</td>\n",
|
|||
|
" <td>77.540001</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8033</th>\n",
|
|||
|
" <td>2024-05-21</td>\n",
|
|||
|
" <td>77.559998</td>\n",
|
|||
|
" <td>78.220001</td>\n",
|
|||
|
" <td>77.500000</td>\n",
|
|||
|
" <td>77.720001</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8034</th>\n",
|
|||
|
" <td>2024-05-22</td>\n",
|
|||
|
" <td>77.699997</td>\n",
|
|||
|
" <td>81.019997</td>\n",
|
|||
|
" <td>77.440002</td>\n",
|
|||
|
" <td>80.720001</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8035</th>\n",
|
|||
|
" <td>2024-05-23</td>\n",
|
|||
|
" <td>80.099998</td>\n",
|
|||
|
" <td>80.699997</td>\n",
|
|||
|
" <td>79.169998</td>\n",
|
|||
|
" <td>79.260002</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>8036 rows × 5 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Date Open High Low Close\n",
|
|||
|
"0 1992-06-26 0.328125 0.347656 0.320313 0.335938\n",
|
|||
|
"1 1992-06-29 0.339844 0.367188 0.332031 0.359375\n",
|
|||
|
"2 1992-06-30 0.367188 0.371094 0.343750 0.347656\n",
|
|||
|
"3 1992-07-01 0.351563 0.359375 0.339844 0.355469\n",
|
|||
|
"4 1992-07-02 0.359375 0.359375 0.347656 0.355469\n",
|
|||
|
"... ... ... ... ... ...\n",
|
|||
|
"8031 2024-05-17 75.269997 78.000000 74.919998 77.849998\n",
|
|||
|
"8032 2024-05-20 77.680000 78.320000 76.709999 77.540001\n",
|
|||
|
"8033 2024-05-21 77.559998 78.220001 77.500000 77.720001\n",
|
|||
|
"8034 2024-05-22 77.699997 81.019997 77.440002 80.720001\n",
|
|||
|
"8035 2024-05-23 80.099998 80.699997 79.169998 79.260002\n",
|
|||
|
"\n",
|
|||
|
"[8036 rows x 5 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 34,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df_dropped_columns"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 65,
|
|||
|
"metadata": {},
|
|||
|
"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>Date</th>\n",
|
|||
|
" <th>Open</th>\n",
|
|||
|
" <th>High</th>\n",
|
|||
|
" <th>Low</th>\n",
|
|||
|
" <th>Close</th>\n",
|
|||
|
" <th>Adj Close</th>\n",
|
|||
|
" <th>Volume</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0</th>\n",
|
|||
|
" <td>1992-06-26</td>\n",
|
|||
|
" <td>0.328125</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.320313</td>\n",
|
|||
|
" <td>0.335938</td>\n",
|
|||
|
" <td>0.260703</td>\n",
|
|||
|
" <td>224358400</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>1992-06-29</td>\n",
|
|||
|
" <td>0.339844</td>\n",
|
|||
|
" <td>0.367188</td>\n",
|
|||
|
" <td>0.332031</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.278891</td>\n",
|
|||
|
" <td>58732800</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>1992-06-30</td>\n",
|
|||
|
" <td>0.367188</td>\n",
|
|||
|
" <td>0.371094</td>\n",
|
|||
|
" <td>0.343750</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.269797</td>\n",
|
|||
|
" <td>34777600</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <td>1992-07-06</td>\n",
|
|||
|
" <td>0.351563</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.275860</td>\n",
|
|||
|
" <td>5753600</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>6</th>\n",
|
|||
|
" <td>1992-07-07</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.275860</td>\n",
|
|||
|
" <td>10662400</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8031</th>\n",
|
|||
|
" <td>2024-05-17</td>\n",
|
|||
|
" <td>75.269997</td>\n",
|
|||
|
" <td>78.000000</td>\n",
|
|||
|
" <td>74.919998</td>\n",
|
|||
|
" <td>77.849998</td>\n",
|
|||
|
" <td>77.849998</td>\n",
|
|||
|
" <td>14436500</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8032</th>\n",
|
|||
|
" <td>2024-05-20</td>\n",
|
|||
|
" <td>77.680000</td>\n",
|
|||
|
" <td>78.320000</td>\n",
|
|||
|
" <td>76.709999</td>\n",
|
|||
|
" <td>77.540001</td>\n",
|
|||
|
" <td>77.540001</td>\n",
|
|||
|
" <td>11183800</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8033</th>\n",
|
|||
|
" <td>2024-05-21</td>\n",
|
|||
|
" <td>77.559998</td>\n",
|
|||
|
" <td>78.220001</td>\n",
|
|||
|
" <td>77.500000</td>\n",
|
|||
|
" <td>77.720001</td>\n",
|
|||
|
" <td>77.720001</td>\n",
|
|||
|
" <td>8916600</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8034</th>\n",
|
|||
|
" <td>2024-05-22</td>\n",
|
|||
|
" <td>77.699997</td>\n",
|
|||
|
" <td>81.019997</td>\n",
|
|||
|
" <td>77.440002</td>\n",
|
|||
|
" <td>80.720001</td>\n",
|
|||
|
" <td>80.720001</td>\n",
|
|||
|
" <td>22063400</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8035</th>\n",
|
|||
|
" <td>2024-05-23</td>\n",
|
|||
|
" <td>80.099998</td>\n",
|
|||
|
" <td>80.699997</td>\n",
|
|||
|
" <td>79.169998</td>\n",
|
|||
|
" <td>79.260002</td>\n",
|
|||
|
" <td>79.260002</td>\n",
|
|||
|
" <td>4651418</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>8034 rows × 7 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Date Open High Low Close Adj Close \\\n",
|
|||
|
"0 1992-06-26 0.328125 0.347656 0.320313 0.335938 0.260703 \n",
|
|||
|
"1 1992-06-29 0.339844 0.367188 0.332031 0.359375 0.278891 \n",
|
|||
|
"2 1992-06-30 0.367188 0.371094 0.343750 0.347656 0.269797 \n",
|
|||
|
"5 1992-07-06 0.351563 0.355469 0.347656 0.355469 0.275860 \n",
|
|||
|
"6 1992-07-07 0.355469 0.355469 0.347656 0.355469 0.275860 \n",
|
|||
|
"... ... ... ... ... ... ... \n",
|
|||
|
"8031 2024-05-17 75.269997 78.000000 74.919998 77.849998 77.849998 \n",
|
|||
|
"8032 2024-05-20 77.680000 78.320000 76.709999 77.540001 77.540001 \n",
|
|||
|
"8033 2024-05-21 77.559998 78.220001 77.500000 77.720001 77.720001 \n",
|
|||
|
"8034 2024-05-22 77.699997 81.019997 77.440002 80.720001 80.720001 \n",
|
|||
|
"8035 2024-05-23 80.099998 80.699997 79.169998 79.260002 79.260002 \n",
|
|||
|
"\n",
|
|||
|
" Volume \n",
|
|||
|
"0 224358400 \n",
|
|||
|
"1 58732800 \n",
|
|||
|
"2 34777600 \n",
|
|||
|
"5 5753600 \n",
|
|||
|
"6 10662400 \n",
|
|||
|
"... ... \n",
|
|||
|
"8031 14436500 \n",
|
|||
|
"8032 11183800 \n",
|
|||
|
"8033 8916600 \n",
|
|||
|
"8034 22063400 \n",
|
|||
|
"8035 4651418 \n",
|
|||
|
"\n",
|
|||
|
"[8034 rows x 7 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 65,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df_dropped_rows = df.drop([3, 4]) # Удаление строк с индексами 3 и 4\n",
|
|||
|
"df_dropped_rows"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"8. Создание новых столбцов на основе данных из существующих столбцов датафрейма"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 36,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df['Difference'] = df['High'] - df['Low']"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 37,
|
|||
|
"metadata": {},
|
|||
|
"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>Date</th>\n",
|
|||
|
" <th>Open</th>\n",
|
|||
|
" <th>High</th>\n",
|
|||
|
" <th>Low</th>\n",
|
|||
|
" <th>Close</th>\n",
|
|||
|
" <th>Adj Close</th>\n",
|
|||
|
" <th>Volume</th>\n",
|
|||
|
" <th>Difference</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0</th>\n",
|
|||
|
" <td>1992-06-26</td>\n",
|
|||
|
" <td>0.328125</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.320313</td>\n",
|
|||
|
" <td>0.335938</td>\n",
|
|||
|
" <td>0.260703</td>\n",
|
|||
|
" <td>224358400</td>\n",
|
|||
|
" <td>0.027343</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>1992-06-29</td>\n",
|
|||
|
" <td>0.339844</td>\n",
|
|||
|
" <td>0.367188</td>\n",
|
|||
|
" <td>0.332031</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.278891</td>\n",
|
|||
|
" <td>58732800</td>\n",
|
|||
|
" <td>0.035157</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>1992-06-30</td>\n",
|
|||
|
" <td>0.367188</td>\n",
|
|||
|
" <td>0.371094</td>\n",
|
|||
|
" <td>0.343750</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.269797</td>\n",
|
|||
|
" <td>34777600</td>\n",
|
|||
|
" <td>0.027344</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <td>1992-07-01</td>\n",
|
|||
|
" <td>0.351563</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.339844</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.275860</td>\n",
|
|||
|
" <td>18316800</td>\n",
|
|||
|
" <td>0.019531</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>1992-07-02</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.275860</td>\n",
|
|||
|
" <td>13996800</td>\n",
|
|||
|
" <td>0.011719</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8031</th>\n",
|
|||
|
" <td>2024-05-17</td>\n",
|
|||
|
" <td>75.269997</td>\n",
|
|||
|
" <td>78.000000</td>\n",
|
|||
|
" <td>74.919998</td>\n",
|
|||
|
" <td>77.849998</td>\n",
|
|||
|
" <td>77.849998</td>\n",
|
|||
|
" <td>14436500</td>\n",
|
|||
|
" <td>3.080002</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8032</th>\n",
|
|||
|
" <td>2024-05-20</td>\n",
|
|||
|
" <td>77.680000</td>\n",
|
|||
|
" <td>78.320000</td>\n",
|
|||
|
" <td>76.709999</td>\n",
|
|||
|
" <td>77.540001</td>\n",
|
|||
|
" <td>77.540001</td>\n",
|
|||
|
" <td>11183800</td>\n",
|
|||
|
" <td>1.610001</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8033</th>\n",
|
|||
|
" <td>2024-05-21</td>\n",
|
|||
|
" <td>77.559998</td>\n",
|
|||
|
" <td>78.220001</td>\n",
|
|||
|
" <td>77.500000</td>\n",
|
|||
|
" <td>77.720001</td>\n",
|
|||
|
" <td>77.720001</td>\n",
|
|||
|
" <td>8916600</td>\n",
|
|||
|
" <td>0.720001</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8034</th>\n",
|
|||
|
" <td>2024-05-22</td>\n",
|
|||
|
" <td>77.699997</td>\n",
|
|||
|
" <td>81.019997</td>\n",
|
|||
|
" <td>77.440002</td>\n",
|
|||
|
" <td>80.720001</td>\n",
|
|||
|
" <td>80.720001</td>\n",
|
|||
|
" <td>22063400</td>\n",
|
|||
|
" <td>3.579995</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8035</th>\n",
|
|||
|
" <td>2024-05-23</td>\n",
|
|||
|
" <td>80.099998</td>\n",
|
|||
|
" <td>80.699997</td>\n",
|
|||
|
" <td>79.169998</td>\n",
|
|||
|
" <td>79.260002</td>\n",
|
|||
|
" <td>79.260002</td>\n",
|
|||
|
" <td>4651418</td>\n",
|
|||
|
" <td>1.529999</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>8036 rows × 8 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Date Open High Low Close Adj Close \\\n",
|
|||
|
"0 1992-06-26 0.328125 0.347656 0.320313 0.335938 0.260703 \n",
|
|||
|
"1 1992-06-29 0.339844 0.367188 0.332031 0.359375 0.278891 \n",
|
|||
|
"2 1992-06-30 0.367188 0.371094 0.343750 0.347656 0.269797 \n",
|
|||
|
"3 1992-07-01 0.351563 0.359375 0.339844 0.355469 0.275860 \n",
|
|||
|
"4 1992-07-02 0.359375 0.359375 0.347656 0.355469 0.275860 \n",
|
|||
|
"... ... ... ... ... ... ... \n",
|
|||
|
"8031 2024-05-17 75.269997 78.000000 74.919998 77.849998 77.849998 \n",
|
|||
|
"8032 2024-05-20 77.680000 78.320000 76.709999 77.540001 77.540001 \n",
|
|||
|
"8033 2024-05-21 77.559998 78.220001 77.500000 77.720001 77.720001 \n",
|
|||
|
"8034 2024-05-22 77.699997 81.019997 77.440002 80.720001 80.720001 \n",
|
|||
|
"8035 2024-05-23 80.099998 80.699997 79.169998 79.260002 79.260002 \n",
|
|||
|
"\n",
|
|||
|
" Volume Difference \n",
|
|||
|
"0 224358400 0.027343 \n",
|
|||
|
"1 58732800 0.035157 \n",
|
|||
|
"2 34777600 0.027344 \n",
|
|||
|
"3 18316800 0.019531 \n",
|
|||
|
"4 13996800 0.011719 \n",
|
|||
|
"... ... ... \n",
|
|||
|
"8031 14436500 3.080002 \n",
|
|||
|
"8032 11183800 1.610001 \n",
|
|||
|
"8033 8916600 0.720001 \n",
|
|||
|
"8034 22063400 3.579995 \n",
|
|||
|
"8035 4651418 1.529999 \n",
|
|||
|
"\n",
|
|||
|
"[8036 rows x 8 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 37,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"9. Удаление строк с пустыми значениями"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 38,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Date 0\n",
|
|||
|
"Open 0\n",
|
|||
|
"High 0\n",
|
|||
|
"Low 0\n",
|
|||
|
"Close 0\n",
|
|||
|
"Adj Close 0\n",
|
|||
|
"Volume 0\n",
|
|||
|
"Difference 0\n",
|
|||
|
"dtype: int64\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"print(df.isna().sum())"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 39,
|
|||
|
"metadata": {},
|
|||
|
"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>Date</th>\n",
|
|||
|
" <th>Open</th>\n",
|
|||
|
" <th>High</th>\n",
|
|||
|
" <th>Low</th>\n",
|
|||
|
" <th>Close</th>\n",
|
|||
|
" <th>Adj Close</th>\n",
|
|||
|
" <th>Volume</th>\n",
|
|||
|
" <th>Difference</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>0</th>\n",
|
|||
|
" <td>1992-06-26</td>\n",
|
|||
|
" <td>0.328125</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.320313</td>\n",
|
|||
|
" <td>0.335938</td>\n",
|
|||
|
" <td>0.260703</td>\n",
|
|||
|
" <td>224358400</td>\n",
|
|||
|
" <td>0.027343</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <td>1992-06-29</td>\n",
|
|||
|
" <td>0.339844</td>\n",
|
|||
|
" <td>0.367188</td>\n",
|
|||
|
" <td>0.332031</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.278891</td>\n",
|
|||
|
" <td>58732800</td>\n",
|
|||
|
" <td>0.035157</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <td>1992-06-30</td>\n",
|
|||
|
" <td>0.367188</td>\n",
|
|||
|
" <td>0.371094</td>\n",
|
|||
|
" <td>0.343750</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.269797</td>\n",
|
|||
|
" <td>34777600</td>\n",
|
|||
|
" <td>0.027344</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <td>1992-07-01</td>\n",
|
|||
|
" <td>0.351563</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.339844</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.275860</td>\n",
|
|||
|
" <td>18316800</td>\n",
|
|||
|
" <td>0.019531</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <td>1992-07-02</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.359375</td>\n",
|
|||
|
" <td>0.347656</td>\n",
|
|||
|
" <td>0.355469</td>\n",
|
|||
|
" <td>0.275860</td>\n",
|
|||
|
" <td>13996800</td>\n",
|
|||
|
" <td>0.011719</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8031</th>\n",
|
|||
|
" <td>2024-05-17</td>\n",
|
|||
|
" <td>75.269997</td>\n",
|
|||
|
" <td>78.000000</td>\n",
|
|||
|
" <td>74.919998</td>\n",
|
|||
|
" <td>77.849998</td>\n",
|
|||
|
" <td>77.849998</td>\n",
|
|||
|
" <td>14436500</td>\n",
|
|||
|
" <td>3.080002</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8032</th>\n",
|
|||
|
" <td>2024-05-20</td>\n",
|
|||
|
" <td>77.680000</td>\n",
|
|||
|
" <td>78.320000</td>\n",
|
|||
|
" <td>76.709999</td>\n",
|
|||
|
" <td>77.540001</td>\n",
|
|||
|
" <td>77.540001</td>\n",
|
|||
|
" <td>11183800</td>\n",
|
|||
|
" <td>1.610001</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8033</th>\n",
|
|||
|
" <td>2024-05-21</td>\n",
|
|||
|
" <td>77.559998</td>\n",
|
|||
|
" <td>78.220001</td>\n",
|
|||
|
" <td>77.500000</td>\n",
|
|||
|
" <td>77.720001</td>\n",
|
|||
|
" <td>77.720001</td>\n",
|
|||
|
" <td>8916600</td>\n",
|
|||
|
" <td>0.720001</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8034</th>\n",
|
|||
|
" <td>2024-05-22</td>\n",
|
|||
|
" <td>77.699997</td>\n",
|
|||
|
" <td>81.019997</td>\n",
|
|||
|
" <td>77.440002</td>\n",
|
|||
|
" <td>80.720001</td>\n",
|
|||
|
" <td>80.720001</td>\n",
|
|||
|
" <td>22063400</td>\n",
|
|||
|
" <td>3.579995</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>8035</th>\n",
|
|||
|
" <td>2024-05-23</td>\n",
|
|||
|
" <td>80.099998</td>\n",
|
|||
|
" <td>80.699997</td>\n",
|
|||
|
" <td>79.169998</td>\n",
|
|||
|
" <td>79.260002</td>\n",
|
|||
|
" <td>79.260002</td>\n",
|
|||
|
" <td>4651418</td>\n",
|
|||
|
" <td>1.529999</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>8036 rows × 8 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" Date Open High Low Close Adj Close \\\n",
|
|||
|
"0 1992-06-26 0.328125 0.347656 0.320313 0.335938 0.260703 \n",
|
|||
|
"1 1992-06-29 0.339844 0.367188 0.332031 0.359375 0.278891 \n",
|
|||
|
"2 1992-06-30 0.367188 0.371094 0.343750 0.347656 0.269797 \n",
|
|||
|
"3 1992-07-01 0.351563 0.359375 0.339844 0.355469 0.275860 \n",
|
|||
|
"4 1992-07-02 0.359375 0.359375 0.347656 0.355469 0.275860 \n",
|
|||
|
"... ... ... ... ... ... ... \n",
|
|||
|
"8031 2024-05-17 75.269997 78.000000 74.919998 77.849998 77.849998 \n",
|
|||
|
"8032 2024-05-20 77.680000 78.320000 76.709999 77.540001 77.540001 \n",
|
|||
|
"8033 2024-05-21 77.559998 78.220001 77.500000 77.720001 77.720001 \n",
|
|||
|
"8034 2024-05-22 77.699997 81.019997 77.440002 80.720001 80.720001 \n",
|
|||
|
"8035 2024-05-23 80.099998 80.699997 79.169998 79.260002 79.260002 \n",
|
|||
|
"\n",
|
|||
|
" Volume Difference \n",
|
|||
|
"0 224358400 0.027343 \n",
|
|||
|
"1 58732800 0.035157 \n",
|
|||
|
"2 34777600 0.027344 \n",
|
|||
|
"3 18316800 0.019531 \n",
|
|||
|
"4 13996800 0.011719 \n",
|
|||
|
"... ... ... \n",
|
|||
|
"8031 14436500 3.080002 \n",
|
|||
|
"8032 11183800 1.610001 \n",
|
|||
|
"8033 8916600 0.720001 \n",
|
|||
|
"8034 22063400 3.579995 \n",
|
|||
|
"8035 4651418 1.529999 \n",
|
|||
|
"\n",
|
|||
|
"[8036 rows x 8 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 39,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.dropna() "
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"10. Заполнение пустых значений на основе существующих данных"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df.fillna(df.mean(), inplace=True)\n",
|
|||
|
"df.fillna(df.median(), inplace=True)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"**Возможности визуализации**"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 41,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"import matplotlib.pyplot as plt"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 43,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAz8AAAHDCAYAAAAKmqQIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACC/0lEQVR4nO3dd3hT1f8H8HdW073poi2UvVeBWrZS2QqKKIoKouDAAfoV4aeg4ihuHAhOwIEoMkSUvZGy9yqblkJboHTPJPf3R8ltbpO0aZs0afN+PU8f7z335NyTS4R8es75HJkgCAKIiIiIiIjqObm9O0BERERERFQbGPwQEREREZFTYPBDREREREROgcEPERERERE5BQY/RERERETkFBj8EBERERGRU2DwQ0REREREToHBDxEREREROQUGP0RERCSRmZmJc+fOQaPR2LsrRERWxeCHiJzWL7/8gkuXLonnCxcuREpKiv06RPXCkCFDMGHCBHt3o0pKSkrw4YcfomPHjlCr1fDz80Pz5s2xadMme3fNYjKZDG+99Va1X/v8889XWm/+/PmIjIxEUVFRte5DRPbH4IeIrGbhwoWQyWQmf9q1a2fv7hnZsWMHpk6dikuXLmHdunWYNGkS5HL+tUjV999//2H9+vV47bXX7N0VixUVFSEuLg4zZsxAv379sHTpUmzYsAGbN29GbGysXfr01ltvQSaT4caNGyavN27cGMOGDavlXgHjxo1DcXExvvnmm1q/NxFZh9LeHSCi+mfWrFmIiooSz9977z079sa8KVOmoF+/fmJfX375ZYSGhtq5V1SXffTRR+jfvz+aNWtm765Y7IMPPsCePXuwbt069OvXz97dqbaCggIolbb9WuPq6oqxY8fi008/xQsvvACZTGbT+xGR9TH4ISKrEQQBQOm0n+joaLH8+++/N/sbXHtq1aoVzp8/j+PHjyMwMBBNmza1d5eoDktPT8c///yD+fPn27srFtNoNJgzZw5eeeWVOh34AKWBSW148MEH8eGHH2LLli246667auWeRGQ9nN9BRFZTUlICAFAoFJXWNTU//6OPPoJMJpN8Cdu6dStkMhn+/PNPozY8PT0xbtw4SVlmZiYmT56MiIgIqNVqNGvWDB988AF0Op1Y59KlS5DJZFi4cCE8PDwQExODpk2bYtKkSZDJZJI29VP59u/fL7nPjRs3jN7D5cuX8dxzz6Fly5Zwc3NDQEAARo0aJVlXpHfo0CEMGjQIDRo0kEwPtHQqj7kpho0bN5bUGzdunFFZcnIy3NzcIJPJJH3766+/MHToUISFhUGtVqNp06Z45513oNVqJa/v16+fyXvHxcWJdfRrKH799Ve0bNkSrq6ui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QXF0OtVlfa9hNPPCH5PDZv3hz33nsv1q5dC61WC0EQsGzZMtxzzz0QBEHy/8LAgQORlZVl0TOqqmXLlmHDhg1GP8HBwRW+TqvVYuPGjRgxYgTCwsLE8mbNmmHw4MEmXxMXFydZ99ehQwd4e3vjwoULRnX9/PxQUFCA/Pz8ar4zIrIXTnsjIqu5fPky3N3d4e3tXaXXvfnmmwgLC8PTTz9tdn3F+PHjK23n7NmzOHr0qNlpLenp6SbLp02bht69e2PYsGFm9/owtY6jvIKCAsTHx2PBggVISUkRE0AApcGTXteuXaFSqfDWW28hMDBQnPZmyVQePX3w5+PjY/Frdu7cib///hubNm1CUlKS0fUTJ07gjTfewObNm42+RBv231LNmzc3KmvRogXy8/Nx/fp1hISEWPzM9Bo0aIChQ4fixx9/RNeuXfHjjz+aDWT0xowZg6lTp2Lv3r0ICgrC1q1b8c0332Dnzp1GdVevXo13330Xhw8fluzlYmmQYth/vfP
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 1000x500 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"#Линейная диаграмма\n",
|
|||
|
"plt.figure(figsize=(10, 5))\n",
|
|||
|
"df['High'].plot(title='Линейная диаграмма (столбец High)')\n",
|
|||
|
"plt.show()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 45,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 800x500 with 0 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkQAAAGdCAYAAADzOWwgAAAAOXRFWHRTb2Z0d2FyZQBNY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ODtBRAwCAYBMWyDffsGGDrrvuOs/z4yFl1KhRys/P1yOPPKLDhw9r7Nixqqqq0sCBA7Vs2TK1bt3a8zOLFi3SuHHjNGjQIIWEhGjEiBGaM2eOpz8qKkrLly9XVlaW+vXrp06dOmnatGle9yoCAABmC5r7EAUz7kMEAEDz0yLuQwQAAOAvBCIAAGA8AhEAADAegQgAABiPQAQAAIxHIAIAAMYjEAEAAOMRiAAAgPEIRAAAwHgEIgAAYDwCEQAAMB6BCAAAGI9ABAAAjEcgAgAAxiMQAQAA4xGIAACA8QhEAADAeAQiAABgPAIRAAAwHoEIAAAYj0AEAACMRyACAADGIxABAADjEYgAAIDxCEQAAMB4BCIAAGA8AhEAADAegQgAABiPQAQAAIxHIAIAAMYjEAEAAOMRiAAAgPEIRAAAwHgEIgAAYDwCEQAAMB6BCAAAGI9ABAAAjEcgAgAAxiMQAQAA4xGIAACA8QhEAADAeAQiAABgPAIRAAAwHoEIAAAYj0AEAACMRyACAADGIxABAADjEYgAAIDxCEQAAMB4BCIAAGA8AhEAADAegQgAABgvqANRQ0ODpk6dquTkZEVGRuqCCy7Q9OnTZVmWZ4xlWZo2bZri4+MVGRmptLQ07dy50+t1KisrlZmZKbvdrujoaI0ZM0Y1NTX+PhwAABC
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"#Гистограмма\n",
|
|||
|
"plt.figure(figsize=(8, 5))\n",
|
|||
|
"df.plot.hist(column=[\"Open\"], bins=80)\n",
|
|||
|
"plt.show()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 47,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAADFIAAAOeCAY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+1HD81VdfzY477pj6+vrcf//96d27d8O5N998M0OGDMn999+fe++9N7vvvvvGGL1RO+20U/77v/8711xzzcYeBQAAAACAf3ObbOwBAAAAAABgVZdccklef/31XHXVVatFFEmy7bbbNkQUVVVVa30MGjSo4XUvvvhivvSlL6VLly5p3bp1dt5551x99dWNznDeeec1ut/o0aMb1vz+979P3759M3LkyLRv3z5t2rTJrrvumptuuqnRvVbVs2fPiv1eeeWVfP3rX89OO+2Utm3bpqamJsOGDcv//u//NqyZMWPGe37m8847L0ny97//PV/5ylfSp0+ftGnTJh06dMihhx6a+fPnrzbLI488kqFDh6ZTp04Vex144IGNXp9VTZ48udFZevbsWbFu9OjRqx179tln06ZNm1RVVVXMdvPNN2f48OHp3r17qqur07t371xwwQVZsWJFxesHDRrU6HsPHjy4YU1VVVVOPvnkTJ06NX369Enr1q2zyy67ZNasWRV7NfWarfy8m266aV566aWKc7Nnz26Y4cEHH1xtzhEjRqx2/Y4//vhUVVWlb9++Fce/853vZPfdd0+HDh3Spk2b7LLLLrnhhhtWe31jpk+fnrfffrviOiTJT37ykyxYsCCXXnppRUSRJG3atMnVV1+dqqqqjBs3brXPO2vWrBx//PHp0KFDampqctRRR+XVV19d7b1vv/32DBw4MJtvvnnatWuX4cOH57HHHqtYM3r06LRt2zbPPfdcRowYkbZt26ZTp075+te/vtrfcZJ86lOfyi233BK/IwwAAAAAgPXVcmMPAAAAAAAAq7rllluyzTbbNOm34V977bUNf7733nszceLEXH755enYsWOSpEuXLkn+9Zv2Bw0alHnz5uXkk09Or169cv3112f06NFZtGjRGu9u8e79TzvttIpzCxcuzMSJE9O2bduceuqp6dSpU6ZMmZLPfOYzmTp1ar7whS8063P/7W9/y0033ZRDDz00vXr1ygsvvJCf/OQn2XvvvfP444+ne/fu2WGHHSpmmjhxYv7yl7/k8ssvbzjWr1+/JMmf/vSnPPDAAxk5cmS23HLLzJ8/PxMmTMigQYPy+OOPZ7PNNkuSLF68OMOGDUt9fX1OP/309OjRo9HP2xTjxo1Lr169kiSXXXZZo1+yX9XYsWOzdOnS1Y5Pnjw5bdu2zemnn562bdvmnnvuydixY1NXV5dLL720Yu2WW26Z8ePHVxxbNcKZOXNmrrvuupx66qmprq7OlVdemaFDh+aPf/xjQ8DQ1Gu2UosWLTJlypSKazVp0qS0bt260c/UunXrTJ8+PS+++GI6d+6c5F//Nq+77rq0bt16tfVXXHFFDj744BxxxBF566238stf/jKHHnpobr311gwfPnxtlzUPPPBAOnTokK233rri+C233JLWrVvnsMMOa/R1vXr1yp577pl77rknb775Ztq0adNw7uSTT87HPvaxnHfeeXniiScyYcKE/P3vf28IfJJ//cyMGjUqQ4YMycUXX5w33ngjEyZMyJ577plHHnmkIqRZsWJFhgwZkt122y3f+c53ctddd+Wyyy5L7969c+KJJ1bMtcsuu+Tyyy/PY489tlpwAgAAAAAAzSGkAAAAAADgQ6Wuri7PPfdcDjnkkCat/+IXv9jw57fffjsTJ07MiBEjVrvrwcrgYMqUKTniiCOSJCeccEL23nvvnHPOOTnmmGPSrl27ir2qqqoq9j/nnHMq9lz5m/FvvfXW7L333kn+dWeBXXbZJaeffno+97nPpVWrVtlkk00a1jd2Z4qVdtpppzz55JMN65PkyCOPzPbbb5+rrroq5557brp06VIx01133ZVnnnmm4thKw4cPz+c+97mKYwcddFAGDBiQG2+8MUceeWSS5A9/+ENeeOGF/OIXv8jIkSPX+HnXZvny5UmSAw44ILvsskuS5Je//OV7hhSPPfZYrrnmmgwbNiy33357xblp06ZVfIn/hBNOyAknnJArr7wyF154YaqrqxvO1dbWNnoN3u3RRx/Ngw8+2DDfyJEj06dPn4wdOza/+tWvkjT9mq306U9/OpMmTWoIKd54441cd911+cxnPpNp06atNkPv3r3TokWLXHvttfna176WJLnxxhvTrl279OvXL6+88krF+ieffHK1kKF///757ne/+54hxdy5c1f7OUiSxx9/PH369Km4fqvaeeedM3PmzMybNy877bRTw/FNN900d999d1q1apUk2XrrrXPGGWfklltuycEHH5zXX389p556ao499thMnDix4XWjRo1Knz59ctFFF1UcX7p0aT7/+c/n3HPPTfKvv+P+/fvnqquuWi2k2GabbRrmF1IAAAAAALA+NnnvJQAAAAAA8MGpq6tLkoqoYUO47bbb0rVr14q7RLRq1SqnnnpqXn/99cycObNi/VtvvbXWL5qvtOuuuzZEFEnSpk2bfOUrX8mCBQvy8MMPJ0nDnQf+8Y9/rHWv6urqhohixYoVWbhwYdq2bZs+ffo07NUc7/4C/vLly7Nw4cJsu+22+djHPlax32uvvZYk6dChQ7PfY6WVd19o7K4Ka3P22Wenf//+OfTQQ1c79+75X3vttbz88ssZOHBg3njjjcydO7fZMw4YMKAhokiSrbbaKoccckjuuOOOrFixYrX3XNs1W+nII4/M3Llz8+CDDyb5VxRRW1ub/fbbb41zHH300Zk0aVLD80mTJmXUqFEVAc1K757n1VdfzeLFizNw4MAm/XtYuHBhtthii9WOv/baa+/587Xy/Mqfx5WOO+64hogiSU488cS0bNkyt912W5LkzjvvzKJFi/KFL3whL7/8csOjRYsW2W233fK73/1utfc64YQTKp4PHDgwf/vb31Zbt/KzvPzyy2udHQAAAAAA3ouQAgAAAAC
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 4000x1000 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"#Столбчатая диаграмма\n",
|
|||
|
"plt.figure(figsize=(40, 10))\n",
|
|||
|
"df['Open'].value_counts().plot(kind='bar', title='Столбчатая диаграмма (Open)')\n",
|
|||
|
"plt.show()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 68,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAApIAAAZGCAYAAAAcaEFMAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABTDElEQVR4nO3de3SddZ3o/0+S0lIuCSBtCVBpJIOCSRFFKS3RRlBAcBFDxLEoiJw5gqKCRcf2eAF1Wh1bBZWDMy4HVATUEAoGy0UWxQzEOcixB+KMUmo73AItiElvFMjO74/+Eom00v1pLk36eq2VZfbzfPd+vuWP+u5z+e6S3t7e3gAAgCKVjvQEAAAYnYQkAAApQhIAgBQhCQBAipAEACBFSAIAkCIkAQBIEZIAAKQISQAAUoQkAAApQhIYUk899VT8z//5P+PVr3517LbbblFSUtL/M23atJGeHgA7YNxITwAYu5577rl461vfGitXroxzzjknjjnmmNh9990jImLx4sXx7LPPjvAMAdgRQhIYMkuWLImHHnoo5s2bFwsWLBiw7/rrrxeSAKOcS9vAkFm5cmVERBx33HHbNb6kpCQuuOCCAdtOPfXUl10Cb25ujpKSkli2bFn/tquvvjpKSkpi9erV/dsKhUJMnz49SkpK4uqrr+7f/qEPfehln3nNNddEaWlpfPWrX33Fef75z3+Oiy66KKZNmxYTJkyIgw8+OM4666x4+umnt/met73tbXHkkUdudd9rX/vaOPHEEwfM+/LLL4/a2trYfffdY9KkSXHSSSfFb37zm/4xV111Vbz97W+PyZMnx4QJE+KII46IK6+88mWfPW3atCgpKYkLL7zwZftOPPHEKCkpiVNPPbV/27Jly1723zYi4pRTTomSkpK45JJLtvlnBHY9QhIYMvvtt19ExIC4G04/+tGP4sEHH3zFcbfffnt8+MMfjgsuuCA++9nP/s2x69evj7q6uvj2t78d73znO+Pyyy+P8847L37/+9/HY489ts33ffCDH4wHHnggOjo6Bmy/77774qGHHooPfOAD/dvOPffcuPDCC2Pq1Knxta99LT772c/G7rvvHr/+9a/7x1x55ZVxyCGHxPz582Px4sUxderU+OhHPxpXXHHFy469++67x49//ON44YUX+rc99thjceedd/bfavC3/OpXv4pf/OIXrzgO2PW4tA0MmdNOOy0++9nPxpe+9KWYMmXKgHskXxo1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4yrrroqTj/99CgvL/+bx/n+978fq1evji9/+ctFzQ/YdYxYSJ588snxla98ZauXhyK23N908cUXx0EHHRR77rlnHHPMMQOeIrz//vujp6cnvvKVr8Shhx4ab3zjG+Piiy+O5cuXD/m9V8D26+rqiksvvTTe/OY3x5lnnjnkx3viiSfi8ssvj8997nOx9957b3PcHnvsEbfeemuceuqpcdFFF8WCBQviv/7rv17x8w899NCXPTCzvcrKymLOnDnR3Nwczz77bCxZsiTe//73R1lZ2YDPf+KJJ+JPf/rTNj/n5z//eWzevDluvvnm+MhHPhLvete74oQTThhwuXtrPvzhD8f3vve9aG5ufsXL2hs3boxLL700PvrRj8YhhxxS3B8U2GXstPdIXnDBBdHe3h7XX399PPDAA/He9743TjrppFixYkVERLzpTW+K0tLSuOqqq6Knpye6urriRz/6UZxwwgmx2267jfDsgT4LFiyIp59+Or75zW9u9+XjHXHppZfGlClT4rzzzvub4yZNmhSve93rIiLiS1/6Uhx88MHxD//wD3/zgZmIiNNPPz3+3//7f3HjjTe+bN8rvTdiy9Pbzz77bHzkIx+J9evXD3hau+/ze3t749JLL93m5/eF50uP19XVNeAeyK2ZM2dOPP744zF58uSYPXv23xx7+eWXx4YNG+J//a//9Yp/JmDXtVM+tf3II4/EVVddFY888kgceOCBERFx8cUXx6233hpXXXVVLFiwIKqqquL222+PM844Iz7ykY9ET09PHHvssZaogJ3If//3f8e3vvWtOOOMM2LWrFnb9Z5HHnkkbr311v7Xa9eujU2bNg3Ytnz58oiI+D//5//E3/3d38VBBx3Uv+/222+PH//4xzF+/PjtnufEiRPjX//1X+OEE06IK6+8Mj760Y9uc+ynP/3paG5ujve+973x4Q9/ON70pjfFn/70p7j55pvju9/97jbXiuxz1FFHRU1NTfzsZz+Lww8/PN74xjcO2F9fXx8f/OAH41vf+lasWLEiTjrppCgUCtHW1hb19fVxwQUXxDvf+c4YP358vPvd7+4P0u9973sxefLk6Ozs3Oax99133+js7IyysrJXjPrbb789/umf/ile9apX/c1xwK5tpwzJBx98MHp6euKwww4bsH3z5s39f6k9+eST8Q//8A9x9tlnx/vf//5Yt25dfOELX4impqa44447huXMB/C3zZ8/P3p7e+NrX/vadr/n5z//efz85z9/2faTTz75Zdv+8R//MSZPnhwf+tCH+re94Q1viPe///1Fz/X444+Pc845J+bNmxennXbagDh9qb322iva2trii1/8Ytx4443xgx/8ICZPnhzHH398HHzwwdt1rLPOOis+85nPDHjI5qWuuuqqmD59enz/+9+PT3/601FRURFHH310zJw5MyK2LGDe3Nwcn/vc5+Liiy+OAw44IM4///yYNGlSfPjDH/6bx95nn322a46VlZVbXcQc4KVKerfnWsxQT6KkJG688cZoaGiIiIif/OQnceaZZ8bvfve7AfcORWz5S/yAAw6Iz3/+83HrrbfGfffd17/vsccei6lTp0Z7e3vMmDFjOP8IwAiYPXt2fOhDHxoQkqPB5ZdfHhdddFGsXr06Xv3qV4/0dADSdsozkkcddVT09PTEmjVroq6ubqtjNm7c+LI13/qic2tPLALsDHp7e+P73/9+vO1tbxORwKg
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 800x2000 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"#Ящик с усами\n",
|
|||
|
"plt.figure(figsize=(8, 20))\n",
|
|||
|
"df[\"Volume\"].plot(kind = \"box\", title='Ящик с усами')\n",
|
|||
|
"plt.show()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 161,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 800x500 with 0 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAigAAAGzCAYAAAAFROyYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACklklEQVR4nOzdeZxkVXn4/8+5t9bel5nunn2BGWbYFQiMGgVBENFEJXH5oQYl8koEIhI1mqggalBiIlFB40u/ogYUjVtERQEFooIsCsg2MMMwe+/d1V37Xc7vj3Nrm16ml6pepp/361V2d9Wte0/X4NxnnvOc5yittUYIIYQQYgGx5nsAQgghhBCHkgBFCCGEEAuOBChCCCGEWHAkQBFCCCHEgiMBihBCCCEWHAlQhBBCCLHgSIAihBBCiAVHAhQhhBBCLDgSoAghhBBiwZEARYgl7Mwzz+TMM8+cs+t997vfpa2tjWQyOWfXXEyuueYalFKzem9/f/+kxzmOw5o1a7jppptmdB0h5ooEKEJM00033YRSitNPP32+hzKh9evXo5QqPjo6OvjzP/9zfvjDH1bl/Ol0mmuuuYZ77rlnyu/xPI+rr76aK664goaGhorXHMfh85//PKeddhqNjY00NDRw2mmn8fnPfx7Hcaoy5vmglOLyyy8f97Wbb74ZpRQPP/zwnI4pHA5z1VVX8alPfYpsNjun1xZiOiRAEWKabrnlFtavX8+DDz7Ijh075ns4Ezr55JP51re+xbe+9S3e//73c+DAAd74xjfy5S9/edbnTqfTfPzjH59WgPKTn/yE7du3c+mll1Y8n0qleNWrXsV73/teurq6+PSnP82//du/sXLlSt773vfyqle9ilQqNesxLwYf+chHyGQyNb/OO9/5Tvr7+7n11ltrfi0hZkoCFCGmYdeuXfzud7/jP/7jP1i+fDm33HLLlN7nui75fL7Go6u0atUq3va2t/G2t72ND37wg/z2t7+lvr6ez33uc3M6joKvf/3rvPSlL2XVqlUVz1911VXce++9fOELX+AnP/kJl112GX//93/Pj3/8Y774xS9y77338v73v39exjzXQqEQsVis5tdpaWnh3HPP5eabb675tYSYKQlQhJiGW265hdbWVi644AL+6q/+atwA5YUXXkApxWc/+1luuOEGjjrqKKLRKE899RQAzzzzDH/1V39FW1sbsViMU089lf/93/+tOMfg4CDvf//7OeGEE2hoaKCpqYnzzz+fxx57bMZj7+rqYuvWrezatWvS43p7e7nkkkvo7OwkFotx0kkn8Y1vfKPi91u+fDkAH//4x4vTSNdcc82E58xms9xxxx2cc845Fc/v27ePr33ta7zyla8cdyrksssu46yzzuKrX/0q+/btKz5fmDq55ZZbOOaYY4jFYpxyyincd999Y86xf/9+3vWud9HZ2Uk0GuW4447j//2//1dxzD333INSiu9+97t86lOfYvXq1cRiMc4+++w5zZKNV4OSyWT4h3/4B5YtW0ZjYyN/8Rd/wf79+yf8zIeHh7n44otpaWmhubmZd77znaTT6THHvepVr+I3v/kNg4ODtfp1hJiV0HwPQIjF5JZbbuGNb3wjkUiEt771rXzpS1/ioYce4rTTThtz7Ne//nWy2SyXXnop0WiUtrY2nnzyyWIW4UMf+hD19fV897vf5fWvfz3f//73ecMb3gDA888/z49+9CP++q//mg0bNtDT08N//dd/8YpXvIKnnnqKlStXTnvsjuOwd+9e2tvbJzwmk8lw5plnsmPHDi6//HI2bNjA9773PS6++GKGh4d573vfy/Lly/nSl77E3//93/OGN7yBN77xjQCceOKJE573kUceIZ/P8+IXv7ji+Z///Od4nsc73vGOCd/7jne8g1//+tfccccd/O3f/m3x+XvvvZfbbruNf/iHfyAajXLTTTfx6le/mgcffJDjjz8egJ6eHs4444xiQLN8+XJ+/vOfc8kllzAyMsKVV15Zca1Pf/rTWJbF+9//fhKJBNdffz0XXXQRv//97ycc3+Fks9lxC1enWih88cUX893vfpe3v/3tnHHGGdx7771ccMEFEx7/pje9iQ0bNnDdddfxhz/8ga9+9at0dHTwmc98puK4U045Ba01v/vd73jta187vV9KiLmghRBT8vDDD2tA33nnnVprrX3f16tXr9bvfe97K47btWuXBnRTU5Pu7e2teO3ss8/WJ5xwgs5ms8XnfN/XL3nJS/SmTZuKz2WzWe153pjzRqNRfe211x52rOvWrdPnnnuu7uvr0319ffqxxx7Tb3nLWzSgr7jiiuJxr3jFK/QrXvGK4s833HCDBvR///d/F5/L5/N627ZtuqGhQY+MjGitte7r69OAvvrqqw87Fq21/upXv6oB/ac//ani+SuvvFID+o9//OOE7/3DH/6gAX3VVVcVnwM0oB9++OHic7t379axWEy/4Q1vKD53ySWX6BUrVuj+/v6Kc77lLW/Rzc3NOp1Oa621/vWvf60BvXXrVp3L5YrH/ed//ue4456qwjgnezz00EPF46+++mpd/tfyI488ogF95ZVXVpz34osvHvP5F977rne9q+LYN7zhDbq9vX3M2A4cOKAB/ZnPfGZGv5sQtSZTPEJM0S233EJnZydnnXUWYKYZ3vzmN/Od73wHz/PGHH/hhRcWp0LATNv86le/4k1vehOjo6P09/fT39/PwMAA5513Hs899xz79+8HIBqNYlnm/56e5zEwMEBDQwPHHHMMf/jDH6Y03l/+8pcsX76c5cuXc9JJJ/G9732Pt7/97WP+JV3uZz/7GV1dXbz1rW8tPhcOh/mHf/gHkskk995775SufaiBgQEAWltbK54fHR0FoLGxccL3Fl4bGRmpeH7btm2ccsopxZ/Xrl3LX/7lX/KLX/wCz/PQWvP973+f173udWiti593f38/5513HolEYsxn+c53vpNIJFL8+c///M8Bk9Gaqb/8y7/kzjvvHPP4wAc+cNj33nHHHQC85z3vqXj+iiuumPA9f/d3f1fx85//+Z8zMDAw5vMr/FkcblmyEPNFpniEmALP8/jOd77DWWedVVHDcfrpp/Pv//7v3H333Zx77rkV79mwYUPFzzt27EBrzUc/+lE++tGPjnud3t5eVq1ahe/7/Od//ic33XQTu3btqgiAJpuiKXf66afzyU9+EqUUdXV1bN26lZaWlknfs3v3bjZt2lQMjgq2bt1afH02tNYVPxeCj0KgMp6JgphNmzaNOXbz5s2k02n6+vqwLIvh4WG+8pWv8JWvfGXcc/f29lb8vHbt2oqfCzfxoaGhCcd3OKtXrx5TewNU1NRMZPfu3ViWNea/paOPPnrC90z2OzQ1NRWfL/xZzLTvihC1JgGKEFPwq1/9ioMHD/Kd73yH73znO2Nev+WWW8YEKPF4vOJn3/cBeP/7389555037nUKN55//dd/5aMf/Sjvete7+MQnPkFbWxuWZXHllVcWz3M4y5YtG/fGOB8KQdXQ0BCrV68uPl8IfB5//HFOPvnkcd/7+OOPA3DsscdO65qFz+ltb3sbf/M3fzPuMYfWzdi2Pe5xhwZWC9lUf4dC0LVs2bKaj0mImZAARYgpuOWWW+jo6ODGG28c89oPfvADfvjDH/LlL395TFBSbuPGjYCZMjlc4PA///M/nHXWWXzta1+reH54eLimN5R169bx+OOP4/t+RRblmWeeKb4O0/9X95YtWwCzTPuEE04oPn/++edj2zbf+ta3JiyU/eY3v0koFOLVr351xfPPPffcmGOfffZZ6urqilNrjY2NeJ63YAK16Vq3bh2+77Nr166KjFE1VhYVMoGFIFGIhUZqUIQ4jEwmww9+8ANe+9rX8ld/9VdjHpdffjmjo6NjlgofqqOjgzPPPJP/+q//4uDBg2Ne7+vrK35v2/aYf/F+73vfK9ao1MprXvMauru7ue2224rPua7LF77wBRoaGnjFK14BQF1dHWACpqk45ZRTiEQiY7qmrlmzhne+853cddddfOlLXxrzvi9/+cv86le/4pJLLqnIvADcf//9FTUke/f
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"#Диаграмма с областями\n",
|
|||
|
"plt.figure(figsize=(8, 5))\n",
|
|||
|
"df[['Open', 'High']].plot(kind='area', alpha=0.2, title='Area Plot (Open, High)')\n",
|
|||
|
"plt.show()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 69,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"<Axes: xlabel='Open', ylabel='Volume'>"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 69,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAioAAAHACAYAAACMB0PKAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA9lElEQVR4nO3deXxU9cHv8e9kJQlJCElYAoEECEVkMcoiRFEUa7lWRVu9zcXCg1RvLQhofR7x8XFrVVCr7QUpWhdQi2C1gktrFRUS2XcFpZCQsAjEhEB2SGJy7h8000wyM5mZzOScJJ/365XXi5xzZuY3P5I53/xWm2EYhgAAACwoyOwCAAAAuEJQAQAAlkVQAQAAlkVQAQAAlkVQAQAAlkVQAQAAlkVQAQAAlkVQAQAAlkVQAQAAlkVQAQAAltVhgkp2drauv/56JSUlyWazac2aNV4/x8cff6xLL71U0dHRSkxM1E9+8hMdPnzY72UFAACe6TBBpbKyUiNHjtSSJUt8enx+fr5uvPFGXXXVVdqzZ48+/vhjnTp1SjfffLOfSwoAADxl64ibEtpsNq1evVpTpkyxH6uurtaDDz6olStXqqSkRMOGDdNTTz2lK6+8UpL0zjvvKDMzU9XV1QoKOp/fPvjgA914442qrq5WaGioCe8EAIDOrcO0qLRk9uzZ2rx5s1atWqWvvvpKt9xyi370ox8pJydHknTJJZcoKChIy5YtU11dnUpLS/XGG29o0qRJhBQAAEzSKVpUjh49qgEDBujo0aNKSkqyXzdp0iSNGTNGTz75pCQpKytLt956q4qLi1VXV6dx48bp73//u7p162bCuwAAAJ2iRWXv3r2qq6vT4MGD1bVrV/tXVlaWDh06JEkqKCjQHXfcoenTp2v79u3KyspSWFiYfvrTn6oDZjkAANqFELML0BYqKioUHBysnTt3Kjg42OFc165dJUlLlixRbGysnn76afu5P//5z0pOTtbWrVt16aWXtmmZAQBAJwkq6enpqqurU2FhoS6//HKn11RVVdkH0TZoCDX19fU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IKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLIIKAACwLMsElYULF8pms2nevHlmFwUAAFiEJYLK9u3b9eKLL2rEiBFmFwUAAFiI6UGloqJCU6dO1UsvvaS4uDiziwMAACzE9KAya9YsXXfddZo0aZLZRQEAABYTYuaLr1q1Srt27dL27ds9ur66ulrV1dX278vKygJVNAAAYAGmtagcO3ZMc+fO1YoVK9SlSxePHrNgwQLFxsbav5KTkwNcSgAAYCabYRiGGS+8Zs0a3XTTTQoODrYfq6urk81mU1BQkKqrqx3OSc5bVJKTk1VaWqqYmJg2KzsAAPBdWVmZYmNjPbp/m9b1c/XVV2vv3r0Ox2bMmKEhQ4bo/vvvbxZSJCk8PFzh4eFtVUQAAGAy04JKdHS0hg0b5nAsKipK8fHxzY4DAIDOyfRZPwAAAK6YOuunqfXr15tdBAAAYCG0qAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAAAAMsiqAA
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"#Диаграмма рассеяния\n",
|
|||
|
"df.plot.scatter(x=\"Open\", y=\"Volume\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
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EClUll7+t1JamoqYmJibJqDOCa6Z0WYGTduHMxmM95+++1q60wmEwoLC2+7/xtvvAGO4zB58mSUlpZWW5+YmIjly5fXK9P1q4NbrzQ+//zzeh3n+rNWd3oP18XHx+PUqVOoqKiocf31q6i5c+fi+PHj1a6q7rnnHhw6dAgJCQnWZWVlZVi8eDHCwsIQHR1d67kjIyNx7tw55OTkWJedOHEC+/btq1P2uho8eDA8PT3x3nvvwWg0Vlt/8/mByibXlJQU9OjRw6Y5iGOiKyvCTJ8+ffDEE0/g/fffx/HjxzFo0CBIJBJcvHgRa9euxRdffIH777+/1v179OiBBQsW4Mknn0Tr1q0xefJktGzZEiUlJdi1axf+/PNPvPPOO/XK5Onpid69e2P+/PkwGo0IDg7GP//8c9urnpp06tQJADBr1iwMHjzY2lGiNiNHjsTbb7+N3bt3Y9CgQdXWh4eHo0ePHtZnjm4tVi+99BJWr16NoUOHYtasWfD19cXy5cuRmpqK33777bb3Dh955BF8+umnGDx4MKZNm4bs7GwsWrQIbdu2tXZksQVPT08sXLgQkydPRlxcHCZMmICAgACkpaXhr7/+Qs+ePfH1119bt9+2bRs4jsPIkSNtloE4MGb9EInTuN51/fDhw7fd7tau0NctXryY69SpEyeXyzkPDw+uffv23IsvvshlZGTU6fyJiYncAw88wAUFBXESiYTz8fHhBgwYwC1fvrxal+2PPvqo2v4AuDfeeMP6Oj09nRs1ahTn7e3NeXl5cWPHjuUyMjKqbXe963pOTk61Y5pMJu6pp57iAgICOIFAUKdu7B06dOCmTZtW6/oFCxZwALiuXbvWuD4lJYW
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 800x500 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"#Круговая диаграмма\n",
|
|||
|
"\n",
|
|||
|
"df['ForPieChart'] = df['Volume'] % 500 #Дополнительный столбец для демонстрации диаграммы\n",
|
|||
|
"\n",
|
|||
|
"plt.figure(figsize=(8, 5))\n",
|
|||
|
"df['ForPieChart'].value_counts().plot(kind='pie', autopct='%1.1f%%', title='Pie Chart (Volume)')\n",
|
|||
|
"plt.show()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 73,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"0 400\n",
|
|||
|
"1 300\n",
|
|||
|
"2 100\n",
|
|||
|
"3 300\n",
|
|||
|
"4 300\n",
|
|||
|
" ... \n",
|
|||
|
"8031 0\n",
|
|||
|
"8032 300\n",
|
|||
|
"8033 100\n",
|
|||
|
"8034 400\n",
|
|||
|
"8035 418\n",
|
|||
|
"Name: ForPieChart, Length: 8036, dtype: int64"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 73,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df['ForPieChart']"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"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.5"
|
|||
|
}
|
|||
|
},
|
|||
|
"nbformat": 4,
|
|||
|
"nbformat_minor": 2
|
|||
|
}
|