1864 lines
303 KiB
Plaintext
1864 lines
303 KiB
Plaintext
|
{
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Тестим Pandas"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Считываем csv:"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 30,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"import pandas\n",
|
|||
|
"\n",
|
|||
|
"# Считаем csv\n",
|
|||
|
"data_frame = pandas.read_csv(\"data/kc_house_data.csv\", index_col=\"id\")\n",
|
|||
|
"# Сохраняем data_frame в новый csv\n",
|
|||
|
"data_frame.to_csv(\"data/new_kc_house_data.csv\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Получение сведений о data_frame:"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 31,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Общая информация о data_frame:\n",
|
|||
|
"<class 'pandas.core.frame.DataFrame'>\n",
|
|||
|
"Index: 21613 entries, 7129300520 to 1523300157\n",
|
|||
|
"Data columns (total 20 columns):\n",
|
|||
|
" # Column Non-Null Count Dtype \n",
|
|||
|
"--- ------ -------------- ----- \n",
|
|||
|
" 0 date 21613 non-null object \n",
|
|||
|
" 1 price 21613 non-null float64\n",
|
|||
|
" 2 bedrooms 21613 non-null int64 \n",
|
|||
|
" 3 bathrooms 21613 non-null float64\n",
|
|||
|
" 4 sqft_living 21613 non-null int64 \n",
|
|||
|
" 5 sqft_lot 21613 non-null int64 \n",
|
|||
|
" 6 floors 21613 non-null float64\n",
|
|||
|
" 7 waterfront 21613 non-null int64 \n",
|
|||
|
" 8 view 21613 non-null int64 \n",
|
|||
|
" 9 condition 21613 non-null int64 \n",
|
|||
|
" 10 grade 21613 non-null int64 \n",
|
|||
|
" 11 sqft_above 21613 non-null int64 \n",
|
|||
|
" 12 sqft_basement 21613 non-null int64 \n",
|
|||
|
" 13 yr_built 21613 non-null int64 \n",
|
|||
|
" 14 yr_renovated 21613 non-null int64 \n",
|
|||
|
" 15 zipcode 21613 non-null int64 \n",
|
|||
|
" 16 lat 21613 non-null float64\n",
|
|||
|
" 17 long 21613 non-null float64\n",
|
|||
|
" 18 sqft_living15 21613 non-null int64 \n",
|
|||
|
" 19 sqft_lot15 21613 non-null int64 \n",
|
|||
|
"dtypes: float64(5), int64(14), object(1)\n",
|
|||
|
"memory usage: 3.5+ MB\n",
|
|||
|
"None \n",
|
|||
|
"\n",
|
|||
|
"Первые строки data_frame:\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0 3 1.00 1180 \n",
|
|||
|
"6414100192 20141209T000000 538000.0 3 2.25 2570 \n",
|
|||
|
"5631500400 20150225T000000 180000.0 2 1.00 770 \n",
|
|||
|
"2487200875 20141209T000000 604000.0 4 3.00 1960 \n",
|
|||
|
"1954400510 20150218T000000 510000.0 3 2.00 1680 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition grade sqft_above \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 5650 1.0 0 0 3 7 1180 \n",
|
|||
|
"6414100192 7242 2.0 0 0 3 7 2170 \n",
|
|||
|
"5631500400 10000 1.0 0 0 3 6 770 \n",
|
|||
|
"2487200875 5000 1.0 0 0 5 7 1050 \n",
|
|||
|
"1954400510 8080 1.0 0 0 3 8 1680 \n",
|
|||
|
"\n",
|
|||
|
" sqft_basement yr_built yr_renovated zipcode lat long \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 0 1955 0 98178 47.5112 -122.257 \n",
|
|||
|
"6414100192 400 1951 1991 98125 47.7210 -122.319 \n",
|
|||
|
"5631500400 0 1933 0 98028 47.7379 -122.233 \n",
|
|||
|
"2487200875 910 1965 0 98136 47.5208 -122.393 \n",
|
|||
|
"1954400510 0 1987 0 98074 47.6168 -122.045 \n",
|
|||
|
"\n",
|
|||
|
" sqft_living15 sqft_lot15 \n",
|
|||
|
"id \n",
|
|||
|
"7129300520 1340 5650 \n",
|
|||
|
"6414100192 1690 7639 \n",
|
|||
|
"5631500400 2720 8062 \n",
|
|||
|
"2487200875 1360 5000 \n",
|
|||
|
"1954400510 1800 7503 \n",
|
|||
|
"\n",
|
|||
|
"Описание данных data_frame:\n",
|
|||
|
" price bedrooms bathrooms sqft_living sqft_lot \\\n",
|
|||
|
"count 2.161300e+04 21613.000000 21613.000000 21613.000000 2.161300e+04 \n",
|
|||
|
"mean 5.400881e+05 3.370842 2.114757 2079.899736 1.510697e+04 \n",
|
|||
|
"std 3.671272e+05 0.930062 0.770163 918.440897 4.142051e+04 \n",
|
|||
|
"min 7.500000e+04 0.000000 0.000000 290.000000 5.200000e+02 \n",
|
|||
|
"25% 3.219500e+05 3.000000 1.750000 1427.000000 5.040000e+03 \n",
|
|||
|
"50% 4.500000e+05 3.000000 2.250000 1910.000000 7.618000e+03 \n",
|
|||
|
"75% 6.450000e+05 4.000000 2.500000 2550.000000 1.068800e+04 \n",
|
|||
|
"max 7.700000e+06 33.000000 8.000000 13540.000000 1.651359e+06 \n",
|
|||
|
"\n",
|
|||
|
" floors waterfront view condition grade \\\n",
|
|||
|
"count 21613.000000 21613.000000 21613.000000 21613.000000 21613.000000 \n",
|
|||
|
"mean 1.494309 0.007542 0.234303 3.409430 7.656873 \n",
|
|||
|
"std 0.539989 0.086517 0.766318 0.650743 1.175459 \n",
|
|||
|
"min 1.000000 0.000000 0.000000 1.000000 1.000000 \n",
|
|||
|
"25% 1.000000 0.000000 0.000000 3.000000 7.000000 \n",
|
|||
|
"50% 1.500000 0.000000 0.000000 3.000000 7.000000 \n",
|
|||
|
"75% 2.000000 0.000000 0.000000 4.000000 8.000000 \n",
|
|||
|
"max 3.500000 1.000000 4.000000 5.000000 13.000000 \n",
|
|||
|
"\n",
|
|||
|
" sqft_above sqft_basement yr_built yr_renovated zipcode \\\n",
|
|||
|
"count 21613.000000 21613.000000 21613.000000 21613.000000 21613.000000 \n",
|
|||
|
"mean 1788.390691 291.509045 1971.005136 84.402258 98077.939805 \n",
|
|||
|
"std 828.090978 442.575043 29.373411 401.679240 53.505026 \n",
|
|||
|
"min 290.000000 0.000000 1900.000000 0.000000 98001.000000 \n",
|
|||
|
"25% 1190.000000 0.000000 1951.000000 0.000000 98033.000000 \n",
|
|||
|
"50% 1560.000000 0.000000 1975.000000 0.000000 98065.000000 \n",
|
|||
|
"75% 2210.000000 560.000000 1997.000000 0.000000 98118.000000 \n",
|
|||
|
"max 9410.000000 4820.000000 2015.000000 2015.000000 98199.000000 \n",
|
|||
|
"\n",
|
|||
|
" lat long sqft_living15 sqft_lot15 \n",
|
|||
|
"count 21613.000000 21613.000000 21613.000000 21613.000000 \n",
|
|||
|
"mean 47.560053 -122.213896 1986.552492 12768.455652 \n",
|
|||
|
"std 0.138564 0.140828 685.391304 27304.179631 \n",
|
|||
|
"min 47.155900 -122.519000 399.000000 651.000000 \n",
|
|||
|
"25% 47.471000 -122.328000 1490.000000 5100.000000 \n",
|
|||
|
"50% 47.571800 -122.230000 1840.000000 7620.000000 \n",
|
|||
|
"75% 47.678000 -122.125000 2360.000000 10083.000000 \n",
|
|||
|
"max 47.777600 -121.315000 6210.000000 871200.000000 \n",
|
|||
|
"\n",
|
|||
|
"Количество строк и столбцов data_frame: (21613, 20)\n",
|
|||
|
"\n",
|
|||
|
"Названия столбцов: Index(['date', 'price', 'bedrooms', 'bathrooms', 'sqft_living', 'sqft_lot',\n",
|
|||
|
" 'floors', 'waterfront', 'view', 'condition', 'grade', 'sqft_above',\n",
|
|||
|
" 'sqft_basement', 'yr_built', 'yr_renovated', 'zipcode', 'lat', 'long',\n",
|
|||
|
" 'sqft_living15', 'sqft_lot15'],\n",
|
|||
|
" dtype='object')\n",
|
|||
|
"\n",
|
|||
|
"Типы данных каждого столбца:\n",
|
|||
|
"date object\n",
|
|||
|
"price float64\n",
|
|||
|
"bedrooms int64\n",
|
|||
|
"bathrooms float64\n",
|
|||
|
"sqft_living int64\n",
|
|||
|
"sqft_lot int64\n",
|
|||
|
"floors float64\n",
|
|||
|
"waterfront int64\n",
|
|||
|
"view int64\n",
|
|||
|
"condition int64\n",
|
|||
|
"grade int64\n",
|
|||
|
"sqft_above int64\n",
|
|||
|
"sqft_basement int64\n",
|
|||
|
"yr_built int64\n",
|
|||
|
"yr_renovated int64\n",
|
|||
|
"zipcode int64\n",
|
|||
|
"lat float64\n",
|
|||
|
"long float64\n",
|
|||
|
"sqft_living15 int64\n",
|
|||
|
"sqft_lot15 int64\n",
|
|||
|
"dtype: object \n",
|
|||
|
"\n",
|
|||
|
"Количество пропущенных значений в каждом столбце:\n",
|
|||
|
"date 0\n",
|
|||
|
"price 0\n",
|
|||
|
"bedrooms 0\n",
|
|||
|
"bathrooms 0\n",
|
|||
|
"sqft_living 0\n",
|
|||
|
"sqft_lot 0\n",
|
|||
|
"floors 0\n",
|
|||
|
"waterfront 0\n",
|
|||
|
"view 0\n",
|
|||
|
"condition 0\n",
|
|||
|
"grade 0\n",
|
|||
|
"sqft_above 0\n",
|
|||
|
"sqft_basement 0\n",
|
|||
|
"yr_built 0\n",
|
|||
|
"yr_renovated 0\n",
|
|||
|
"zipcode 0\n",
|
|||
|
"lat 0\n",
|
|||
|
"long 0\n",
|
|||
|
"sqft_living15 0\n",
|
|||
|
"sqft_lot15 0\n",
|
|||
|
"dtype: int64 \n",
|
|||
|
"\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# Общая информация о data_frame\n",
|
|||
|
"print(\"Общая информация о data_frame:\")\n",
|
|||
|
"print(data_frame.info(), \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Первые строки\n",
|
|||
|
"print(\"Первые строки data_frame:\")\n",
|
|||
|
"print(data_frame.head(), \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Описание данных\n",
|
|||
|
"print(\"Описание данных data_frame:\")\n",
|
|||
|
"print(data_frame.describe(), \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Количество строк и столбцов \n",
|
|||
|
"print(f\"Количество строк и столбцов data_frame: {data_frame.shape}\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Названия столбцов\n",
|
|||
|
"print(f\"Названия столбцов: {data_frame.columns}\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Типы данных каждого столбца\n",
|
|||
|
"print(\"Типы данных каждого столбца:\")\n",
|
|||
|
"print(data_frame.dtypes, \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Количество пропущенных значений\n",
|
|||
|
"print(\"Количество пропущенных значений в каждом столбце:\")\n",
|
|||
|
"print(data_frame.isnull().sum(), \"\\n\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Получение сведений о колонках"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 32,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Список всех столбцов: Index(['date', 'price', 'bedrooms', 'bathrooms', 'sqft_living', 'sqft_lot',\n",
|
|||
|
" 'floors', 'waterfront', 'view', 'condition', 'grade', 'sqft_above',\n",
|
|||
|
" 'sqft_basement', 'yr_built', 'yr_renovated', 'zipcode', 'lat', 'long',\n",
|
|||
|
" 'sqft_living15', 'sqft_lot15'],\n",
|
|||
|
" dtype='object')\n",
|
|||
|
"\n",
|
|||
|
"Типы данных каждого столбца:\n",
|
|||
|
"date object\n",
|
|||
|
"price float64\n",
|
|||
|
"bedrooms int64\n",
|
|||
|
"bathrooms float64\n",
|
|||
|
"sqft_living int64\n",
|
|||
|
"sqft_lot int64\n",
|
|||
|
"floors float64\n",
|
|||
|
"waterfront int64\n",
|
|||
|
"view int64\n",
|
|||
|
"condition int64\n",
|
|||
|
"grade int64\n",
|
|||
|
"sqft_above int64\n",
|
|||
|
"sqft_basement int64\n",
|
|||
|
"yr_built int64\n",
|
|||
|
"yr_renovated int64\n",
|
|||
|
"zipcode int64\n",
|
|||
|
"lat float64\n",
|
|||
|
"long float64\n",
|
|||
|
"sqft_living15 int64\n",
|
|||
|
"sqft_lot15 int64\n",
|
|||
|
"dtype: object \n",
|
|||
|
"\n",
|
|||
|
"Описание всех столбцов DataFrame:\n",
|
|||
|
" date price bedrooms bathrooms \\\n",
|
|||
|
"count 21613 2.161300e+04 21613.000000 21613.000000 \n",
|
|||
|
"unique 372 NaN NaN NaN \n",
|
|||
|
"top 20140623T000000 NaN NaN NaN \n",
|
|||
|
"freq 142 NaN NaN NaN \n",
|
|||
|
"mean NaN 5.400881e+05 3.370842 2.114757 \n",
|
|||
|
"std NaN 3.671272e+05 0.930062 0.770163 \n",
|
|||
|
"min NaN 7.500000e+04 0.000000 0.000000 \n",
|
|||
|
"25% NaN 3.219500e+05 3.000000 1.750000 \n",
|
|||
|
"50% NaN 4.500000e+05 3.000000 2.250000 \n",
|
|||
|
"75% NaN 6.450000e+05 4.000000 2.500000 \n",
|
|||
|
"max NaN 7.700000e+06 33.000000 8.000000 \n",
|
|||
|
"\n",
|
|||
|
" sqft_living sqft_lot floors waterfront view \\\n",
|
|||
|
"count 21613.000000 2.161300e+04 21613.000000 21613.000000 21613.000000 \n",
|
|||
|
"unique NaN NaN NaN NaN NaN \n",
|
|||
|
"top NaN NaN NaN NaN NaN \n",
|
|||
|
"freq NaN NaN NaN NaN NaN \n",
|
|||
|
"mean 2079.899736 1.510697e+04 1.494309 0.007542 0.234303 \n",
|
|||
|
"std 918.440897 4.142051e+04 0.539989 0.086517 0.766318 \n",
|
|||
|
"min 290.000000 5.200000e+02 1.000000 0.000000 0.000000 \n",
|
|||
|
"25% 1427.000000 5.040000e+03 1.000000 0.000000 0.000000 \n",
|
|||
|
"50% 1910.000000 7.618000e+03 1.500000 0.000000 0.000000 \n",
|
|||
|
"75% 2550.000000 1.068800e+04 2.000000 0.000000 0.000000 \n",
|
|||
|
"max 13540.000000 1.651359e+06 3.500000 1.000000 4.000000 \n",
|
|||
|
"\n",
|
|||
|
" condition grade sqft_above sqft_basement yr_built \\\n",
|
|||
|
"count 21613.000000 21613.000000 21613.000000 21613.000000 21613.000000 \n",
|
|||
|
"unique NaN NaN NaN NaN NaN \n",
|
|||
|
"top NaN NaN NaN NaN NaN \n",
|
|||
|
"freq NaN NaN NaN NaN NaN \n",
|
|||
|
"mean 3.409430 7.656873 1788.390691 291.509045 1971.005136 \n",
|
|||
|
"std 0.650743 1.175459 828.090978 442.575043 29.373411 \n",
|
|||
|
"min 1.000000 1.000000 290.000000 0.000000 1900.000000 \n",
|
|||
|
"25% 3.000000 7.000000 1190.000000 0.000000 1951.000000 \n",
|
|||
|
"50% 3.000000 7.000000 1560.000000 0.000000 1975.000000 \n",
|
|||
|
"75% 4.000000 8.000000 2210.000000 560.000000 1997.000000 \n",
|
|||
|
"max 5.000000 13.000000 9410.000000 4820.000000 2015.000000 \n",
|
|||
|
"\n",
|
|||
|
" yr_renovated zipcode lat long sqft_living15 \\\n",
|
|||
|
"count 21613.000000 21613.000000 21613.000000 21613.000000 21613.000000 \n",
|
|||
|
"unique NaN NaN NaN NaN NaN \n",
|
|||
|
"top NaN NaN NaN NaN NaN \n",
|
|||
|
"freq NaN NaN NaN NaN NaN \n",
|
|||
|
"mean 84.402258 98077.939805 47.560053 -122.213896 1986.552492 \n",
|
|||
|
"std 401.679240 53.505026 0.138564 0.140828 685.391304 \n",
|
|||
|
"min 0.000000 98001.000000 47.155900 -122.519000 399.000000 \n",
|
|||
|
"25% 0.000000 98033.000000 47.471000 -122.328000 1490.000000 \n",
|
|||
|
"50% 0.000000 98065.000000 47.571800 -122.230000 1840.000000 \n",
|
|||
|
"75% 0.000000 98118.000000 47.678000 -122.125000 2360.000000 \n",
|
|||
|
"max 2015.000000 98199.000000 47.777600 -121.315000 6210.000000 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot15 \n",
|
|||
|
"count 21613.000000 \n",
|
|||
|
"unique NaN \n",
|
|||
|
"top NaN \n",
|
|||
|
"freq NaN \n",
|
|||
|
"mean 12768.455652 \n",
|
|||
|
"std 27304.179631 \n",
|
|||
|
"min 651.000000 \n",
|
|||
|
"25% 5100.000000 \n",
|
|||
|
"50% 7620.000000 \n",
|
|||
|
"75% 10083.000000 \n",
|
|||
|
"max 871200.000000 \n",
|
|||
|
"\n",
|
|||
|
"Количество пропущенных значений в каждом столбце:\n",
|
|||
|
"date 0\n",
|
|||
|
"price 0\n",
|
|||
|
"bedrooms 0\n",
|
|||
|
"bathrooms 0\n",
|
|||
|
"sqft_living 0\n",
|
|||
|
"sqft_lot 0\n",
|
|||
|
"floors 0\n",
|
|||
|
"waterfront 0\n",
|
|||
|
"view 0\n",
|
|||
|
"condition 0\n",
|
|||
|
"grade 0\n",
|
|||
|
"sqft_above 0\n",
|
|||
|
"sqft_basement 0\n",
|
|||
|
"yr_built 0\n",
|
|||
|
"yr_renovated 0\n",
|
|||
|
"zipcode 0\n",
|
|||
|
"lat 0\n",
|
|||
|
"long 0\n",
|
|||
|
"sqft_living15 0\n",
|
|||
|
"sqft_lot15 0\n",
|
|||
|
"dtype: int64 \n",
|
|||
|
"\n",
|
|||
|
"Количество уникальных значений в столбце 'date':\n",
|
|||
|
"date\n",
|
|||
|
"20140623T000000 142\n",
|
|||
|
"20140626T000000 131\n",
|
|||
|
"20140625T000000 131\n",
|
|||
|
"20140708T000000 127\n",
|
|||
|
"20150427T000000 126\n",
|
|||
|
" ... \n",
|
|||
|
"20150131T000000 1\n",
|
|||
|
"20150117T000000 1\n",
|
|||
|
"20150308T000000 1\n",
|
|||
|
"20150515T000000 1\n",
|
|||
|
"20140803T000000 1\n",
|
|||
|
"Name: count, Length: 372, dtype: int64 \n",
|
|||
|
"\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# Список всех столбцов\n",
|
|||
|
"print(f\"Список всех столбцов: {data_frame.columns}\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Типы данных каждого столбца\n",
|
|||
|
"print(\"Типы данных каждого столбца:\")\n",
|
|||
|
"print(data_frame.dtypes, \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Описание всех столбцов\n",
|
|||
|
"print(\"Описание всех столбцов DataFrame:\")\n",
|
|||
|
"print(data_frame.describe(include=\"all\"), \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Количество пропущенных значений в каждом столбце\n",
|
|||
|
"print(\"Количество пропущенных значений в каждом столбце:\")\n",
|
|||
|
"print(data_frame.isnull().sum(), \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Количество уникальных значений в столбце 'date'\n",
|
|||
|
"print(\"Количество уникальных значений в столбце 'date':\")\n",
|
|||
|
"print(data_frame[\"date\"].value_counts(), \"\\n\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Вывод строки и стобца"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 33,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Столбец 'date':\n",
|
|||
|
"id\n",
|
|||
|
"7129300520 20141013T000000\n",
|
|||
|
"6414100192 20141209T000000\n",
|
|||
|
"5631500400 20150225T000000\n",
|
|||
|
"2487200875 20141209T000000\n",
|
|||
|
"1954400510 20150218T000000\n",
|
|||
|
" ... \n",
|
|||
|
"263000018 20140521T000000\n",
|
|||
|
"6600060120 20150223T000000\n",
|
|||
|
"1523300141 20140623T000000\n",
|
|||
|
"291310100 20150116T000000\n",
|
|||
|
"1523300157 20141015T000000\n",
|
|||
|
"Name: date, Length: 21613, dtype: object \n",
|
|||
|
"\n",
|
|||
|
"Строка с индексом 2:\n",
|
|||
|
"date 20150225T000000\n",
|
|||
|
"price 180000.0\n",
|
|||
|
"bedrooms 2\n",
|
|||
|
"bathrooms 1.0\n",
|
|||
|
"sqft_living 770\n",
|
|||
|
"sqft_lot 10000\n",
|
|||
|
"floors 1.0\n",
|
|||
|
"waterfront 0\n",
|
|||
|
"view 0\n",
|
|||
|
"condition 3\n",
|
|||
|
"grade 6\n",
|
|||
|
"sqft_above 770\n",
|
|||
|
"sqft_basement 0\n",
|
|||
|
"yr_built 1933\n",
|
|||
|
"yr_renovated 0\n",
|
|||
|
"zipcode 98028\n",
|
|||
|
"lat 47.7379\n",
|
|||
|
"long -122.233\n",
|
|||
|
"sqft_living15 2720\n",
|
|||
|
"sqft_lot15 8062\n",
|
|||
|
"Name: 5631500400, dtype: object \n",
|
|||
|
"\n",
|
|||
|
"Значение в первой строке и столбце 'date':\n",
|
|||
|
"3 \n",
|
|||
|
"\n",
|
|||
|
"Значение в строке с индексом 1 и столбце 'date':\n",
|
|||
|
"20141013T000000 \n",
|
|||
|
"\n",
|
|||
|
"Столбцы 'date' и 'price':\n",
|
|||
|
" date price\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0\n",
|
|||
|
"6414100192 20141209T000000 538000.0\n",
|
|||
|
"5631500400 20150225T000000 180000.0\n",
|
|||
|
"2487200875 20141209T000000 604000.0\n",
|
|||
|
"1954400510 20150218T000000 510000.0\n",
|
|||
|
"... ... ...\n",
|
|||
|
"263000018 20140521T000000 360000.0\n",
|
|||
|
"6600060120 20150223T000000 400000.0\n",
|
|||
|
"1523300141 20140623T000000 402101.0\n",
|
|||
|
"291310100 20150116T000000 400000.0\n",
|
|||
|
"1523300157 20141015T000000 325000.0\n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 2 columns] \n",
|
|||
|
"\n",
|
|||
|
"Первые две строки DataFrame:\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0 3 1.00 1180 \n",
|
|||
|
"6414100192 20141209T000000 538000.0 3 2.25 2570 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition grade sqft_above \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 5650 1.0 0 0 3 7 1180 \n",
|
|||
|
"6414100192 7242 2.0 0 0 3 7 2170 \n",
|
|||
|
"\n",
|
|||
|
" sqft_basement yr_built yr_renovated zipcode lat long \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 0 1955 0 98178 47.5112 -122.257 \n",
|
|||
|
"6414100192 400 1951 1991 98125 47.7210 -122.319 \n",
|
|||
|
"\n",
|
|||
|
" sqft_living15 sqft_lot15 \n",
|
|||
|
"id \n",
|
|||
|
"7129300520 1340 5650 \n",
|
|||
|
"6414100192 1690 7639 \n",
|
|||
|
"\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# Вывод столбца 'date'\n",
|
|||
|
"print(\"Столбец 'date':\")\n",
|
|||
|
"print(data_frame[\"date\"], \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Вывод строки с индексом 2\n",
|
|||
|
"print(\"Строка с индексом 2:\")\n",
|
|||
|
"print(data_frame.iloc[2], \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Вывод значения в первой строке и столбце 'date'\n",
|
|||
|
"print(\"Значение в первой строке и столбце 'date':\")\n",
|
|||
|
"print(data_frame.iloc[0, 2], \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Вывод конкретного значения по метке строки и имени столбца\n",
|
|||
|
"print(\"Значение в строке с индексом 1 и столбце 'date':\")\n",
|
|||
|
"print(data_frame.loc[7129300520, \"date\"], \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Вывод нескольких столбцов 'date' и 'price'\n",
|
|||
|
"print(\"Столбцы 'date' и 'price':\")\n",
|
|||
|
"print(data_frame[[\"date\", \"price\"]], \"\\n\")\n",
|
|||
|
"\n",
|
|||
|
"# Вывод первых двух строк\n",
|
|||
|
"print(\"Первые две строки DataFrame:\")\n",
|
|||
|
"print(data_frame.iloc[:2], \"\\n\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Группировка и агрегация данных"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 34,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Средняя цена по количеству спален:\n",
|
|||
|
"bedrooms\n",
|
|||
|
"0 4.095038e+05\n",
|
|||
|
"1 3.176429e+05\n",
|
|||
|
"2 4.013727e+05\n",
|
|||
|
"3 4.662321e+05\n",
|
|||
|
"4 6.354195e+05\n",
|
|||
|
"5 7.865998e+05\n",
|
|||
|
"6 8.255206e+05\n",
|
|||
|
"7 9.511847e+05\n",
|
|||
|
"8 1.105077e+06\n",
|
|||
|
"9 8.939998e+05\n",
|
|||
|
"10 8.193333e+05\n",
|
|||
|
"11 5.200000e+05\n",
|
|||
|
"33 6.400000e+05\n",
|
|||
|
"Name: price, dtype: float64\n",
|
|||
|
"\n",
|
|||
|
"Количество продаж по почтовому индексу:\n",
|
|||
|
"zipcode\n",
|
|||
|
"98001 362\n",
|
|||
|
"98002 199\n",
|
|||
|
"98003 280\n",
|
|||
|
"98004 317\n",
|
|||
|
"98005 168\n",
|
|||
|
" ... \n",
|
|||
|
"98177 255\n",
|
|||
|
"98178 262\n",
|
|||
|
"98188 136\n",
|
|||
|
"98198 280\n",
|
|||
|
"98199 317\n",
|
|||
|
"Name: price, Length: 70, dtype: int64\n",
|
|||
|
"\n",
|
|||
|
"Максимальная цена по количеству ванных комнат:\n",
|
|||
|
"bathrooms\n",
|
|||
|
"0.00 1295650.0\n",
|
|||
|
"0.50 312500.0\n",
|
|||
|
"0.75 785000.0\n",
|
|||
|
"1.00 1300000.0\n",
|
|||
|
"1.25 1388000.0\n",
|
|||
|
"1.50 1500000.0\n",
|
|||
|
"1.75 3278000.0\n",
|
|||
|
"2.00 2200000.0\n",
|
|||
|
"2.25 2400000.0\n",
|
|||
|
"2.50 3070000.0\n",
|
|||
|
"2.75 2700000.0\n",
|
|||
|
"3.00 4489000.0\n",
|
|||
|
"3.25 3640900.0\n",
|
|||
|
"3.50 3710000.0\n",
|
|||
|
"3.75 3650000.0\n",
|
|||
|
"4.00 3400000.0\n",
|
|||
|
"4.25 3850000.0\n",
|
|||
|
"4.50 7062500.0\n",
|
|||
|
"4.75 3650000.0\n",
|
|||
|
"5.00 5350000.0\n",
|
|||
|
"5.25 5110800.0\n",
|
|||
|
"5.50 4500000.0\n",
|
|||
|
"5.75 5570000.0\n",
|
|||
|
"6.00 5300000.0\n",
|
|||
|
"6.25 3300000.0\n",
|
|||
|
"6.50 2238890.0\n",
|
|||
|
"6.75 4668000.0\n",
|
|||
|
"7.50 450000.0\n",
|
|||
|
"7.75 6885000.0\n",
|
|||
|
"8.00 7700000.0\n",
|
|||
|
"Name: price, dtype: float64\n",
|
|||
|
"\n",
|
|||
|
"Общая цена по количеству этажей:\n",
|
|||
|
"floors\n",
|
|||
|
"1.0 4.722489e+09\n",
|
|||
|
"1.5 1.067653e+09\n",
|
|||
|
"2.0 5.347512e+09\n",
|
|||
|
"2.5 1.707158e+08\n",
|
|||
|
"3.0 3.570885e+08\n",
|
|||
|
"3.5 7.466500e+06\n",
|
|||
|
"Name: price, dtype: float64\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# 1. Средняя цена по количеству спален\n",
|
|||
|
"print(\"Средняя цена по количеству спален:\")\n",
|
|||
|
"print(data_frame.groupby(\"bedrooms\")[\"price\"].mean())\n",
|
|||
|
"\n",
|
|||
|
"# 2. Количество продаж по почтовому индексу\n",
|
|||
|
"print(\"\\nКоличество продаж по почтовому индексу:\")\n",
|
|||
|
"print(data_frame.groupby(\"zipcode\")[\"price\"].count())\n",
|
|||
|
"\n",
|
|||
|
"# 3. Максимальная цена по количеству ванных комнат\n",
|
|||
|
"print(\"\\nМаксимальная цена по количеству ванных комнат:\")\n",
|
|||
|
"print(data_frame.groupby(\"bathrooms\")[\"price\"].max())\n",
|
|||
|
"\n",
|
|||
|
"# 4. Общая цена по количеству этажей\n",
|
|||
|
"print(\"\\nОбщая цена по количеству этажей:\")\n",
|
|||
|
"print(data_frame.groupby(\"floors\")[\"price\"].sum())"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Сортировка данных"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 35,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Сортировка по цене (возрастание):\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"3421079032 20150217T000000 75000.0 1 0.00 670 \n",
|
|||
|
"40000362 20140506T000000 78000.0 2 1.00 780 \n",
|
|||
|
"8658300340 20140523T000000 80000.0 1 0.75 430 \n",
|
|||
|
"3028200080 20150324T000000 81000.0 2 1.00 730 \n",
|
|||
|
"3883800011 20141105T000000 82000.0 3 1.00 860 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"8907500070 20150413T000000 5350000.0 5 5.00 8000 \n",
|
|||
|
"2470100110 20140804T000000 5570000.0 5 5.75 9200 \n",
|
|||
|
"9208900037 20140919T000000 6885000.0 6 7.75 9890 \n",
|
|||
|
"9808700762 20140611T000000 7062500.0 5 4.50 10040 \n",
|
|||
|
"6762700020 20141013T000000 7700000.0 6 8.00 12050 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition grade sqft_above \\\n",
|
|||
|
"id \n",
|
|||
|
"3421079032 43377 1.0 0 0 3 3 670 \n",
|
|||
|
"40000362 16344 1.0 0 0 1 5 780 \n",
|
|||
|
"8658300340 5050 1.0 0 0 2 4 430 \n",
|
|||
|
"3028200080 9975 1.0 0 0 1 5 730 \n",
|
|||
|
"3883800011 10426 1.0 0 0 3 6 860 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"8907500070 23985 2.0 0 4 3 12 6720 \n",
|
|||
|
"2470100110 35069 2.0 0 0 3 13 6200 \n",
|
|||
|
"9208900037 31374 2.0 0 4 3 13 8860 \n",
|
|||
|
"9808700762 37325 2.0 1 2 3 11 7680 \n",
|
|||
|
"6762700020 27600 2.5 0 3 4 13 8570 \n",
|
|||
|
"\n",
|
|||
|
" sqft_basement yr_built yr_renovated zipcode lat long \\\n",
|
|||
|
"id \n",
|
|||
|
"3421079032 0 1966 0 98022 47.2638 -121.906 \n",
|
|||
|
"40000362 0 1942 0 98168 47.4739 -122.280 \n",
|
|||
|
"8658300340 0 1912 0 98014 47.6499 -121.909 \n",
|
|||
|
"3028200080 0 1943 0 98168 47.4808 -122.315 \n",
|
|||
|
"3883800011 0 1954 0 98146 47.4987 -122.341 \n",
|
|||
|
"... ... ... ... ... ... ... \n",
|
|||
|
"8907500070 1280 2009 0 98004 47.6232 -122.220 \n",
|
|||
|
"2470100110 3000 2001 0 98039 47.6289 -122.233 \n",
|
|||
|
"9208900037 1030 2001 0 98039 47.6305 -122.240 \n",
|
|||
|
"9808700762 2360 1940 2001 98004 47.6500 -122.214 \n",
|
|||
|
"6762700020 3480 1910 1987 98102 47.6298 -122.323 \n",
|
|||
|
"\n",
|
|||
|
" sqft_living15 sqft_lot15 \n",
|
|||
|
"id \n",
|
|||
|
"3421079032 1160 42882 \n",
|
|||
|
"40000362 1700 10387 \n",
|
|||
|
"8658300340 1200 7500 \n",
|
|||
|
"3028200080 860 9000 \n",
|
|||
|
"3883800011 1140 11250 \n",
|
|||
|
"... ... ... \n",
|
|||
|
"8907500070 4600 21750 \n",
|
|||
|
"2470100110 3560 24345 \n",
|
|||
|
"9208900037 4540 42730 \n",
|
|||
|
"9808700762 3930 25449 \n",
|
|||
|
"6762700020 3940 8800 \n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 20 columns]\n",
|
|||
|
"\n",
|
|||
|
"Сортировка по цене (убывание):\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"6762700020 20141013T000000 7700000.0 6 8.00 12050 \n",
|
|||
|
"9808700762 20140611T000000 7062500.0 5 4.50 10040 \n",
|
|||
|
"9208900037 20140919T000000 6885000.0 6 7.75 9890 \n",
|
|||
|
"2470100110 20140804T000000 5570000.0 5 5.75 9200 \n",
|
|||
|
"8907500070 20150413T000000 5350000.0 5 5.00 8000 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"3883800011 20141105T000000 82000.0 3 1.00 860 \n",
|
|||
|
"3028200080 20150324T000000 81000.0 2 1.00 730 \n",
|
|||
|
"8658300340 20140523T000000 80000.0 1 0.75 430 \n",
|
|||
|
"40000362 20140506T000000 78000.0 2 1.00 780 \n",
|
|||
|
"3421079032 20150217T000000 75000.0 1 0.00 670 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition grade sqft_above \\\n",
|
|||
|
"id \n",
|
|||
|
"6762700020 27600 2.5 0 3 4 13 8570 \n",
|
|||
|
"9808700762 37325 2.0 1 2 3 11 7680 \n",
|
|||
|
"9208900037 31374 2.0 0 4 3 13 8860 \n",
|
|||
|
"2470100110 35069 2.0 0 0 3 13 6200 \n",
|
|||
|
"8907500070 23985 2.0 0 4 3 12 6720 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"3883800011 10426 1.0 0 0 3 6 860 \n",
|
|||
|
"3028200080 9975 1.0 0 0 1 5 730 \n",
|
|||
|
"8658300340 5050 1.0 0 0 2 4 430 \n",
|
|||
|
"40000362 16344 1.0 0 0 1 5 780 \n",
|
|||
|
"3421079032 43377 1.0 0 0 3 3 670 \n",
|
|||
|
"\n",
|
|||
|
" sqft_basement yr_built yr_renovated zipcode lat long \\\n",
|
|||
|
"id \n",
|
|||
|
"6762700020 3480 1910 1987 98102 47.6298 -122.323 \n",
|
|||
|
"9808700762 2360 1940 2001 98004 47.6500 -122.214 \n",
|
|||
|
"9208900037 1030 2001 0 98039 47.6305 -122.240 \n",
|
|||
|
"2470100110 3000 2001 0 98039 47.6289 -122.233 \n",
|
|||
|
"8907500070 1280 2009 0 98004 47.6232 -122.220 \n",
|
|||
|
"... ... ... ... ... ... ... \n",
|
|||
|
"3883800011 0 1954 0 98146 47.4987 -122.341 \n",
|
|||
|
"3028200080 0 1943 0 98168 47.4808 -122.315 \n",
|
|||
|
"8658300340 0 1912 0 98014 47.6499 -121.909 \n",
|
|||
|
"40000362 0 1942 0 98168 47.4739 -122.280 \n",
|
|||
|
"3421079032 0 1966 0 98022 47.2638 -121.906 \n",
|
|||
|
"\n",
|
|||
|
" sqft_living15 sqft_lot15 \n",
|
|||
|
"id \n",
|
|||
|
"6762700020 3940 8800 \n",
|
|||
|
"9808700762 3930 25449 \n",
|
|||
|
"9208900037 4540 42730 \n",
|
|||
|
"2470100110 3560 24345 \n",
|
|||
|
"8907500070 4600 21750 \n",
|
|||
|
"... ... ... \n",
|
|||
|
"3883800011 1140 11250 \n",
|
|||
|
"3028200080 860 9000 \n",
|
|||
|
"8658300340 1200 7500 \n",
|
|||
|
"40000362 1700 10387 \n",
|
|||
|
"3421079032 1160 42882 \n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 20 columns]\n",
|
|||
|
"\n",
|
|||
|
"Сортировка по количеству спален и затем по цене (возрастание):\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"9543000205 20150413T000000 139950.0 0 0.00 844 \n",
|
|||
|
"3980300371 20140926T000000 142000.0 0 0.00 290 \n",
|
|||
|
"6896300380 20141002T000000 228000.0 0 1.00 390 \n",
|
|||
|
"7849202190 20141223T000000 235000.0 0 0.00 1470 \n",
|
|||
|
"2310060040 20140925T000000 240000.0 0 2.50 1810 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"5566100170 20141029T000000 650000.0 10 2.00 3610 \n",
|
|||
|
"8812401450 20141229T000000 660000.0 10 3.00 2920 \n",
|
|||
|
"627300145 20140814T000000 1148000.0 10 5.25 4590 \n",
|
|||
|
"1773100755 20140821T000000 520000.0 11 3.00 3000 \n",
|
|||
|
"2402100895 20140625T000000 640000.0 33 1.75 1620 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition grade sqft_above \\\n",
|
|||
|
"id \n",
|
|||
|
"9543000205 4269 1.0 0 0 4 7 844 \n",
|
|||
|
"3980300371 20875 1.0 0 0 1 1 290 \n",
|
|||
|
"6896300380 5900 1.0 0 0 2 4 390 \n",
|
|||
|
"7849202190 4800 2.0 0 0 3 7 1470 \n",
|
|||
|
"2310060040 5669 2.0 0 0 3 7 1810 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"5566100170 11914 2.0 0 0 4 7 3010 \n",
|
|||
|
"8812401450 3745 2.0 0 0 4 7 1860 \n",
|
|||
|
"627300145 10920 1.0 0 2 3 9 2500 \n",
|
|||
|
"1773100755 4960 2.0 0 0 3 7 2400 \n",
|
|||
|
"2402100895 6000 1.0 0 0 5 7 1040 \n",
|
|||
|
"\n",
|
|||
|
" sqft_basement yr_built yr_renovated zipcode lat long \\\n",
|
|||
|
"id \n",
|
|||
|
"9543000205 0 1913 0 98001 47.2781 -122.250 \n",
|
|||
|
"3980300371 0 1963 0 98024 47.5308 -121.888 \n",
|
|||
|
"6896300380 0 1953 0 98118 47.5260 -122.261 \n",
|
|||
|
"7849202190 0 1996 0 98065 47.5265 -121.828 \n",
|
|||
|
"2310060040 0 2003 0 98038 47.3493 -122.053 \n",
|
|||
|
"... ... ... ... ... ... ... \n",
|
|||
|
"5566100170 600 1958 0 98006 47.5705 -122.175 \n",
|
|||
|
"8812401450 1060 1913 0 98105 47.6635 -122.320 \n",
|
|||
|
"627300145 2090 2008 0 98004 47.5861 -122.113 \n",
|
|||
|
"1773100755 600 1918 1999 98106 47.5560 -122.363 \n",
|
|||
|
"2402100895 580 1947 0 98103 47.6878 -122.331 \n",
|
|||
|
"\n",
|
|||
|
" sqft_living15 sqft_lot15 \n",
|
|||
|
"id \n",
|
|||
|
"9543000205 1380 9600 \n",
|
|||
|
"3980300371 1620 22850 \n",
|
|||
|
"6896300380 2170 6000 \n",
|
|||
|
"7849202190 1060 7200 \n",
|
|||
|
"2310060040 1810 5685 \n",
|
|||
|
"... ... ... \n",
|
|||
|
"5566100170 2040 11914 \n",
|
|||
|
"8812401450 1810 3745 \n",
|
|||
|
"627300145 2730 10400 \n",
|
|||
|
"1773100755 1420 4960 \n",
|
|||
|
"2402100895 1330 4700 \n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 20 columns]\n",
|
|||
|
"\n",
|
|||
|
"Сортировка по почтовому индексу и количеству ванных комнат (убывание):\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"1068000375 20140923T000000 3200000.0 6 5.00 7100 \n",
|
|||
|
"3271800295 20150203T000000 1569500.0 5 4.50 5620 \n",
|
|||
|
"1370802115 20141205T000000 1925000.0 3 4.50 3950 \n",
|
|||
|
"1370802455 20140813T000000 1050000.0 4 4.50 3180 \n",
|
|||
|
"2771604190 20140617T000000 824000.0 7 4.25 3670 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"1312900180 20150325T000000 225000.0 3 1.00 1250 \n",
|
|||
|
"3356403400 20140724T000000 159000.0 3 1.00 1360 \n",
|
|||
|
"1278000210 20150311T000000 110000.0 2 1.00 828 \n",
|
|||
|
"4045700455 20150316T000000 363000.0 3 0.75 2510 \n",
|
|||
|
"9543000205 20150413T000000 139950.0 0 0.00 844 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition grade sqft_above \\\n",
|
|||
|
"id \n",
|
|||
|
"1068000375 18200 2.5 0 0 3 13 5240 \n",
|
|||
|
"3271800295 5800 3.0 0 3 3 11 4700 \n",
|
|||
|
"1370802115 6134 2.0 0 3 3 11 2880 \n",
|
|||
|
"1370802455 4606 2.0 0 3 4 9 1990 \n",
|
|||
|
"2771604190 4000 2.0 0 1 3 8 2800 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"1312900180 7820 1.0 0 0 3 7 1250 \n",
|
|||
|
"3356403400 20000 1.0 0 0 4 7 1360 \n",
|
|||
|
"1278000210 4524 1.0 0 0 3 6 828 \n",
|
|||
|
"4045700455 20000 2.0 0 0 4 7 2510 \n",
|
|||
|
"9543000205 4269 1.0 0 0 4 7 844 \n",
|
|||
|
"\n",
|
|||
|
" sqft_basement yr_built yr_renovated zipcode lat long \\\n",
|
|||
|
"id \n",
|
|||
|
"1068000375 1860 1933 2002 98199 47.6427 -122.408 \n",
|
|||
|
"3271800295 920 1999 0 98199 47.6482 -122.412 \n",
|
|||
|
"1370802115 1070 1998 0 98199 47.6413 -122.405 \n",
|
|||
|
"1370802455 1190 1929 0 98199 47.6402 -122.405 \n",
|
|||
|
"2771604190 870 1964 0 98199 47.6375 -122.388 \n",
|
|||
|
"... ... ... ... ... ... ... \n",
|
|||
|
"1312900180 0 1967 0 98001 47.3397 -122.291 \n",
|
|||
|
"3356403400 0 1953 0 98001 47.2861 -122.253 \n",
|
|||
|
"1278000210 0 1968 2007 98001 47.2655 -122.244 \n",
|
|||
|
"4045700455 0 1961 0 98001 47.2871 -122.287 \n",
|
|||
|
"9543000205 0 1913 0 98001 47.2781 -122.250 \n",
|
|||
|
"\n",
|
|||
|
" sqft_living15 sqft_lot15 \n",
|
|||
|
"id \n",
|
|||
|
"1068000375 3130 6477 \n",
|
|||
|
"3271800295 2360 5800 \n",
|
|||
|
"1370802115 3050 5281 \n",
|
|||
|
"1370802455 2110 5323 \n",
|
|||
|
"2771604190 2010 4000 \n",
|
|||
|
"... ... ... \n",
|
|||
|
"1312900180 1300 7920 \n",
|
|||
|
"3356403400 1530 9997 \n",
|
|||
|
"1278000210 828 5402 \n",
|
|||
|
"4045700455 2130 20000 \n",
|
|||
|
"9543000205 1380 9600 \n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 20 columns]\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"print(\"Сортировка по цене (возрастание):\")\n",
|
|||
|
"print(data_frame.sort_values(by=\"price\"))\n",
|
|||
|
"\n",
|
|||
|
"# 2. Сортировка по цене (убывание)\n",
|
|||
|
"print(\"\\nСортировка по цене (убывание):\")\n",
|
|||
|
"print(data_frame.sort_values(by=\"price\", ascending=False))\n",
|
|||
|
"\n",
|
|||
|
"# 3. Сортировка по количеству спален и затем по цене (возрастание)\n",
|
|||
|
"print(\"\\nСортировка по количеству спален и затем по цене (возрастание):\")\n",
|
|||
|
"print(data_frame.sort_values(by=[\"bedrooms\", \"price\"]))\n",
|
|||
|
"\n",
|
|||
|
"# 4. Сортировка по почтовому индексу и количеству ванных комнат (убывание)\n",
|
|||
|
"print(\"\\nСортировка по почтовому индексу и количеству ванных комнат (убывание):\")\n",
|
|||
|
"print(data_frame.sort_values(by=[\"zipcode\", \"bathrooms\"], ascending=[False, False]))"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Удаление строк и столбцов"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 36,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Удаление строки с индексом 1736800520:\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0 3 1.00 1180 \n",
|
|||
|
"6414100192 20141209T000000 538000.0 3 2.25 2570 \n",
|
|||
|
"5631500400 20150225T000000 180000.0 2 1.00 770 \n",
|
|||
|
"2487200875 20141209T000000 604000.0 4 3.00 1960 \n",
|
|||
|
"1954400510 20150218T000000 510000.0 3 2.00 1680 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 20140521T000000 360000.0 3 2.50 1530 \n",
|
|||
|
"6600060120 20150223T000000 400000.0 4 2.50 2310 \n",
|
|||
|
"1523300141 20140623T000000 402101.0 2 0.75 1020 \n",
|
|||
|
"291310100 20150116T000000 400000.0 3 2.50 1600 \n",
|
|||
|
"1523300157 20141015T000000 325000.0 2 0.75 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition grade sqft_above \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 5650 1.0 0 0 3 7 1180 \n",
|
|||
|
"6414100192 7242 2.0 0 0 3 7 2170 \n",
|
|||
|
"5631500400 10000 1.0 0 0 3 6 770 \n",
|
|||
|
"2487200875 5000 1.0 0 0 5 7 1050 \n",
|
|||
|
"1954400510 8080 1.0 0 0 3 8 1680 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"263000018 1131 3.0 0 0 3 8 1530 \n",
|
|||
|
"6600060120 5813 2.0 0 0 3 8 2310 \n",
|
|||
|
"1523300141 1350 2.0 0 0 3 7 1020 \n",
|
|||
|
"291310100 2388 2.0 0 0 3 8 1600 \n",
|
|||
|
"1523300157 1076 2.0 0 0 3 7 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_basement yr_built yr_renovated zipcode lat long \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 0 1955 0 98178 47.5112 -122.257 \n",
|
|||
|
"6414100192 400 1951 1991 98125 47.7210 -122.319 \n",
|
|||
|
"5631500400 0 1933 0 98028 47.7379 -122.233 \n",
|
|||
|
"2487200875 910 1965 0 98136 47.5208 -122.393 \n",
|
|||
|
"1954400510 0 1987 0 98074 47.6168 -122.045 \n",
|
|||
|
"... ... ... ... ... ... ... \n",
|
|||
|
"263000018 0 2009 0 98103 47.6993 -122.346 \n",
|
|||
|
"6600060120 0 2014 0 98146 47.5107 -122.362 \n",
|
|||
|
"1523300141 0 2009 0 98144 47.5944 -122.299 \n",
|
|||
|
"291310100 0 2004 0 98027 47.5345 -122.069 \n",
|
|||
|
"1523300157 0 2008 0 98144 47.5941 -122.299 \n",
|
|||
|
"\n",
|
|||
|
" sqft_living15 sqft_lot15 \n",
|
|||
|
"id \n",
|
|||
|
"7129300520 1340 5650 \n",
|
|||
|
"6414100192 1690 7639 \n",
|
|||
|
"5631500400 2720 8062 \n",
|
|||
|
"2487200875 1360 5000 \n",
|
|||
|
"1954400510 1800 7503 \n",
|
|||
|
"... ... ... \n",
|
|||
|
"263000018 1530 1509 \n",
|
|||
|
"6600060120 1830 7200 \n",
|
|||
|
"1523300141 1020 2007 \n",
|
|||
|
"291310100 1410 1287 \n",
|
|||
|
"1523300157 1020 1357 \n",
|
|||
|
"\n",
|
|||
|
"[21612 rows x 20 columns]\n",
|
|||
|
"\n",
|
|||
|
"Удаление строк с индексами 1736800520 и 6300500875:\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0 3 1.00 1180 \n",
|
|||
|
"6414100192 20141209T000000 538000.0 3 2.25 2570 \n",
|
|||
|
"5631500400 20150225T000000 180000.0 2 1.00 770 \n",
|
|||
|
"2487200875 20141209T000000 604000.0 4 3.00 1960 \n",
|
|||
|
"1954400510 20150218T000000 510000.0 3 2.00 1680 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 20140521T000000 360000.0 3 2.50 1530 \n",
|
|||
|
"6600060120 20150223T000000 400000.0 4 2.50 2310 \n",
|
|||
|
"1523300141 20140623T000000 402101.0 2 0.75 1020 \n",
|
|||
|
"291310100 20150116T000000 400000.0 3 2.50 1600 \n",
|
|||
|
"1523300157 20141015T000000 325000.0 2 0.75 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition grade sqft_above \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 5650 1.0 0 0 3 7 1180 \n",
|
|||
|
"6414100192 7242 2.0 0 0 3 7 2170 \n",
|
|||
|
"5631500400 10000 1.0 0 0 3 6 770 \n",
|
|||
|
"2487200875 5000 1.0 0 0 5 7 1050 \n",
|
|||
|
"1954400510 8080 1.0 0 0 3 8 1680 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"263000018 1131 3.0 0 0 3 8 1530 \n",
|
|||
|
"6600060120 5813 2.0 0 0 3 8 2310 \n",
|
|||
|
"1523300141 1350 2.0 0 0 3 7 1020 \n",
|
|||
|
"291310100 2388 2.0 0 0 3 8 1600 \n",
|
|||
|
"1523300157 1076 2.0 0 0 3 7 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_basement yr_built yr_renovated zipcode lat long \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 0 1955 0 98178 47.5112 -122.257 \n",
|
|||
|
"6414100192 400 1951 1991 98125 47.7210 -122.319 \n",
|
|||
|
"5631500400 0 1933 0 98028 47.7379 -122.233 \n",
|
|||
|
"2487200875 910 1965 0 98136 47.5208 -122.393 \n",
|
|||
|
"1954400510 0 1987 0 98074 47.6168 -122.045 \n",
|
|||
|
"... ... ... ... ... ... ... \n",
|
|||
|
"263000018 0 2009 0 98103 47.6993 -122.346 \n",
|
|||
|
"6600060120 0 2014 0 98146 47.5107 -122.362 \n",
|
|||
|
"1523300141 0 2009 0 98144 47.5944 -122.299 \n",
|
|||
|
"291310100 0 2004 0 98027 47.5345 -122.069 \n",
|
|||
|
"1523300157 0 2008 0 98144 47.5941 -122.299 \n",
|
|||
|
"\n",
|
|||
|
" sqft_living15 sqft_lot15 \n",
|
|||
|
"id \n",
|
|||
|
"7129300520 1340 5650 \n",
|
|||
|
"6414100192 1690 7639 \n",
|
|||
|
"5631500400 2720 8062 \n",
|
|||
|
"2487200875 1360 5000 \n",
|
|||
|
"1954400510 1800 7503 \n",
|
|||
|
"... ... ... \n",
|
|||
|
"263000018 1530 1509 \n",
|
|||
|
"6600060120 1830 7200 \n",
|
|||
|
"1523300141 1020 2007 \n",
|
|||
|
"291310100 1410 1287 \n",
|
|||
|
"1523300157 1020 1357 \n",
|
|||
|
"\n",
|
|||
|
"[21611 rows x 20 columns]\n",
|
|||
|
"\n",
|
|||
|
"Удаление столбца 'zipcode':\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0 3 1.00 1180 \n",
|
|||
|
"6414100192 20141209T000000 538000.0 3 2.25 2570 \n",
|
|||
|
"5631500400 20150225T000000 180000.0 2 1.00 770 \n",
|
|||
|
"2487200875 20141209T000000 604000.0 4 3.00 1960 \n",
|
|||
|
"1954400510 20150218T000000 510000.0 3 2.00 1680 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 20140521T000000 360000.0 3 2.50 1530 \n",
|
|||
|
"6600060120 20150223T000000 400000.0 4 2.50 2310 \n",
|
|||
|
"1523300141 20140623T000000 402101.0 2 0.75 1020 \n",
|
|||
|
"291310100 20150116T000000 400000.0 3 2.50 1600 \n",
|
|||
|
"1523300157 20141015T000000 325000.0 2 0.75 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition grade sqft_above \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 5650 1.0 0 0 3 7 1180 \n",
|
|||
|
"6414100192 7242 2.0 0 0 3 7 2170 \n",
|
|||
|
"5631500400 10000 1.0 0 0 3 6 770 \n",
|
|||
|
"2487200875 5000 1.0 0 0 5 7 1050 \n",
|
|||
|
"1954400510 8080 1.0 0 0 3 8 1680 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"263000018 1131 3.0 0 0 3 8 1530 \n",
|
|||
|
"6600060120 5813 2.0 0 0 3 8 2310 \n",
|
|||
|
"1523300141 1350 2.0 0 0 3 7 1020 \n",
|
|||
|
"291310100 2388 2.0 0 0 3 8 1600 \n",
|
|||
|
"1523300157 1076 2.0 0 0 3 7 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_basement yr_built yr_renovated lat long \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 0 1955 0 47.5112 -122.257 \n",
|
|||
|
"6414100192 400 1951 1991 47.7210 -122.319 \n",
|
|||
|
"5631500400 0 1933 0 47.7379 -122.233 \n",
|
|||
|
"2487200875 910 1965 0 47.5208 -122.393 \n",
|
|||
|
"1954400510 0 1987 0 47.6168 -122.045 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 0 2009 0 47.6993 -122.346 \n",
|
|||
|
"6600060120 0 2014 0 47.5107 -122.362 \n",
|
|||
|
"1523300141 0 2009 0 47.5944 -122.299 \n",
|
|||
|
"291310100 0 2004 0 47.5345 -122.069 \n",
|
|||
|
"1523300157 0 2008 0 47.5941 -122.299 \n",
|
|||
|
"\n",
|
|||
|
" sqft_living15 sqft_lot15 \n",
|
|||
|
"id \n",
|
|||
|
"7129300520 1340 5650 \n",
|
|||
|
"6414100192 1690 7639 \n",
|
|||
|
"5631500400 2720 8062 \n",
|
|||
|
"2487200875 1360 5000 \n",
|
|||
|
"1954400510 1800 7503 \n",
|
|||
|
"... ... ... \n",
|
|||
|
"263000018 1530 1509 \n",
|
|||
|
"6600060120 1830 7200 \n",
|
|||
|
"1523300141 1020 2007 \n",
|
|||
|
"291310100 1410 1287 \n",
|
|||
|
"1523300157 1020 1357 \n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 19 columns]\n",
|
|||
|
"\n",
|
|||
|
"Удаление столбцов 'bathrooms' и 'floors':\n",
|
|||
|
" date price bedrooms sqft_living sqft_lot \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0 3 1180 5650 \n",
|
|||
|
"6414100192 20141209T000000 538000.0 3 2570 7242 \n",
|
|||
|
"5631500400 20150225T000000 180000.0 2 770 10000 \n",
|
|||
|
"2487200875 20141209T000000 604000.0 4 1960 5000 \n",
|
|||
|
"1954400510 20150218T000000 510000.0 3 1680 8080 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 20140521T000000 360000.0 3 1530 1131 \n",
|
|||
|
"6600060120 20150223T000000 400000.0 4 2310 5813 \n",
|
|||
|
"1523300141 20140623T000000 402101.0 2 1020 1350 \n",
|
|||
|
"291310100 20150116T000000 400000.0 3 1600 2388 \n",
|
|||
|
"1523300157 20141015T000000 325000.0 2 1020 1076 \n",
|
|||
|
"\n",
|
|||
|
" waterfront view condition grade sqft_above sqft_basement \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 0 0 3 7 1180 0 \n",
|
|||
|
"6414100192 0 0 3 7 2170 400 \n",
|
|||
|
"5631500400 0 0 3 6 770 0 \n",
|
|||
|
"2487200875 0 0 5 7 1050 910 \n",
|
|||
|
"1954400510 0 0 3 8 1680 0 \n",
|
|||
|
"... ... ... ... ... ... ... \n",
|
|||
|
"263000018 0 0 3 8 1530 0 \n",
|
|||
|
"6600060120 0 0 3 8 2310 0 \n",
|
|||
|
"1523300141 0 0 3 7 1020 0 \n",
|
|||
|
"291310100 0 0 3 8 1600 0 \n",
|
|||
|
"1523300157 0 0 3 7 1020 0 \n",
|
|||
|
"\n",
|
|||
|
" yr_built yr_renovated zipcode lat long sqft_living15 \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 1955 0 98178 47.5112 -122.257 1340 \n",
|
|||
|
"6414100192 1951 1991 98125 47.7210 -122.319 1690 \n",
|
|||
|
"5631500400 1933 0 98028 47.7379 -122.233 2720 \n",
|
|||
|
"2487200875 1965 0 98136 47.5208 -122.393 1360 \n",
|
|||
|
"1954400510 1987 0 98074 47.6168 -122.045 1800 \n",
|
|||
|
"... ... ... ... ... ... ... \n",
|
|||
|
"263000018 2009 0 98103 47.6993 -122.346 1530 \n",
|
|||
|
"6600060120 2014 0 98146 47.5107 -122.362 1830 \n",
|
|||
|
"1523300141 2009 0 98144 47.5944 -122.299 1020 \n",
|
|||
|
"291310100 2004 0 98027 47.5345 -122.069 1410 \n",
|
|||
|
"1523300157 2008 0 98144 47.5941 -122.299 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot15 \n",
|
|||
|
"id \n",
|
|||
|
"7129300520 5650 \n",
|
|||
|
"6414100192 7639 \n",
|
|||
|
"5631500400 8062 \n",
|
|||
|
"2487200875 5000 \n",
|
|||
|
"1954400510 7503 \n",
|
|||
|
"... ... \n",
|
|||
|
"263000018 1509 \n",
|
|||
|
"6600060120 7200 \n",
|
|||
|
"1523300141 2007 \n",
|
|||
|
"291310100 1287 \n",
|
|||
|
"1523300157 1357 \n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 18 columns]\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"print(\"Удаление строки с индексом 1736800520:\")\n",
|
|||
|
"print(data_frame.drop(index=1736800520))\n",
|
|||
|
"\n",
|
|||
|
"# 2. Удаление нескольких строк по индексам (например, удаляем строки с индексами 0 и 2)\n",
|
|||
|
"print(\"\\nУдаление строк с индексами 1736800520 и 6300500875:\")\n",
|
|||
|
"print(data_frame.drop(index=[1736800520, 6300500875]))\n",
|
|||
|
"\n",
|
|||
|
"# 3. Удаление столбца по имени (например, удаляем столбец 'zipcode')\n",
|
|||
|
"print(\"\\nУдаление столбца 'zipcode':\")\n",
|
|||
|
"print(data_frame.drop(columns=\"zipcode\"))\n",
|
|||
|
"\n",
|
|||
|
"# 4. Удаление нескольких столбцов (например, 'bathrooms' и 'floors')\n",
|
|||
|
"print(\"\\nУдаление столбцов 'bathrooms' и 'floors':\")\n",
|
|||
|
"print(data_frame.drop(columns=[\"bathrooms\", \"floors\"]))"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Создание новых столбцов на основе данных из существующих столбцов"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 37,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Создание нового столбца 'price_per_bedroom':\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0 3 1.00 1180 \n",
|
|||
|
"6414100192 20141209T000000 538000.0 3 2.25 2570 \n",
|
|||
|
"5631500400 20150225T000000 180000.0 2 1.00 770 \n",
|
|||
|
"2487200875 20141209T000000 604000.0 4 3.00 1960 \n",
|
|||
|
"1954400510 20150218T000000 510000.0 3 2.00 1680 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 20140521T000000 360000.0 3 2.50 1530 \n",
|
|||
|
"6600060120 20150223T000000 400000.0 4 2.50 2310 \n",
|
|||
|
"1523300141 20140623T000000 402101.0 2 0.75 1020 \n",
|
|||
|
"291310100 20150116T000000 400000.0 3 2.50 1600 \n",
|
|||
|
"1523300157 20141015T000000 325000.0 2 0.75 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition ... sqft_above \\\n",
|
|||
|
"id ... \n",
|
|||
|
"7129300520 5650 1.0 0 0 3 ... 1180 \n",
|
|||
|
"6414100192 7242 2.0 0 0 3 ... 2170 \n",
|
|||
|
"5631500400 10000 1.0 0 0 3 ... 770 \n",
|
|||
|
"2487200875 5000 1.0 0 0 5 ... 1050 \n",
|
|||
|
"1954400510 8080 1.0 0 0 3 ... 1680 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"263000018 1131 3.0 0 0 3 ... 1530 \n",
|
|||
|
"6600060120 5813 2.0 0 0 3 ... 2310 \n",
|
|||
|
"1523300141 1350 2.0 0 0 3 ... 1020 \n",
|
|||
|
"291310100 2388 2.0 0 0 3 ... 1600 \n",
|
|||
|
"1523300157 1076 2.0 0 0 3 ... 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_basement yr_built yr_renovated zipcode lat long \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 0 1955 0 98178 47.5112 -122.257 \n",
|
|||
|
"6414100192 400 1951 1991 98125 47.7210 -122.319 \n",
|
|||
|
"5631500400 0 1933 0 98028 47.7379 -122.233 \n",
|
|||
|
"2487200875 910 1965 0 98136 47.5208 -122.393 \n",
|
|||
|
"1954400510 0 1987 0 98074 47.6168 -122.045 \n",
|
|||
|
"... ... ... ... ... ... ... \n",
|
|||
|
"263000018 0 2009 0 98103 47.6993 -122.346 \n",
|
|||
|
"6600060120 0 2014 0 98146 47.5107 -122.362 \n",
|
|||
|
"1523300141 0 2009 0 98144 47.5944 -122.299 \n",
|
|||
|
"291310100 0 2004 0 98027 47.5345 -122.069 \n",
|
|||
|
"1523300157 0 2008 0 98144 47.5941 -122.299 \n",
|
|||
|
"\n",
|
|||
|
" sqft_living15 sqft_lot15 price_per_bedroom \n",
|
|||
|
"id \n",
|
|||
|
"7129300520 1340 5650 73966.666667 \n",
|
|||
|
"6414100192 1690 7639 179333.333333 \n",
|
|||
|
"5631500400 2720 8062 90000.000000 \n",
|
|||
|
"2487200875 1360 5000 151000.000000 \n",
|
|||
|
"1954400510 1800 7503 170000.000000 \n",
|
|||
|
"... ... ... ... \n",
|
|||
|
"263000018 1530 1509 120000.000000 \n",
|
|||
|
"6600060120 1830 7200 100000.000000 \n",
|
|||
|
"1523300141 1020 2007 201050.500000 \n",
|
|||
|
"291310100 1410 1287 133333.333333 \n",
|
|||
|
"1523300157 1020 1357 162500.000000 \n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 21 columns]\n",
|
|||
|
"\n",
|
|||
|
"Создание нового столбца 'total_rooms':\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0 3 1.00 1180 \n",
|
|||
|
"6414100192 20141209T000000 538000.0 3 2.25 2570 \n",
|
|||
|
"5631500400 20150225T000000 180000.0 2 1.00 770 \n",
|
|||
|
"2487200875 20141209T000000 604000.0 4 3.00 1960 \n",
|
|||
|
"1954400510 20150218T000000 510000.0 3 2.00 1680 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 20140521T000000 360000.0 3 2.50 1530 \n",
|
|||
|
"6600060120 20150223T000000 400000.0 4 2.50 2310 \n",
|
|||
|
"1523300141 20140623T000000 402101.0 2 0.75 1020 \n",
|
|||
|
"291310100 20150116T000000 400000.0 3 2.50 1600 \n",
|
|||
|
"1523300157 20141015T000000 325000.0 2 0.75 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition ... sqft_basement \\\n",
|
|||
|
"id ... \n",
|
|||
|
"7129300520 5650 1.0 0 0 3 ... 0 \n",
|
|||
|
"6414100192 7242 2.0 0 0 3 ... 400 \n",
|
|||
|
"5631500400 10000 1.0 0 0 3 ... 0 \n",
|
|||
|
"2487200875 5000 1.0 0 0 5 ... 910 \n",
|
|||
|
"1954400510 8080 1.0 0 0 3 ... 0 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"263000018 1131 3.0 0 0 3 ... 0 \n",
|
|||
|
"6600060120 5813 2.0 0 0 3 ... 0 \n",
|
|||
|
"1523300141 1350 2.0 0 0 3 ... 0 \n",
|
|||
|
"291310100 2388 2.0 0 0 3 ... 0 \n",
|
|||
|
"1523300157 1076 2.0 0 0 3 ... 0 \n",
|
|||
|
"\n",
|
|||
|
" yr_built yr_renovated zipcode lat long sqft_living15 \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 1955 0 98178 47.5112 -122.257 1340 \n",
|
|||
|
"6414100192 1951 1991 98125 47.7210 -122.319 1690 \n",
|
|||
|
"5631500400 1933 0 98028 47.7379 -122.233 2720 \n",
|
|||
|
"2487200875 1965 0 98136 47.5208 -122.393 1360 \n",
|
|||
|
"1954400510 1987 0 98074 47.6168 -122.045 1800 \n",
|
|||
|
"... ... ... ... ... ... ... \n",
|
|||
|
"263000018 2009 0 98103 47.6993 -122.346 1530 \n",
|
|||
|
"6600060120 2014 0 98146 47.5107 -122.362 1830 \n",
|
|||
|
"1523300141 2009 0 98144 47.5944 -122.299 1020 \n",
|
|||
|
"291310100 2004 0 98027 47.5345 -122.069 1410 \n",
|
|||
|
"1523300157 2008 0 98144 47.5941 -122.299 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot15 price_per_bedroom total_rooms \n",
|
|||
|
"id \n",
|
|||
|
"7129300520 5650 73966.666667 4.00 \n",
|
|||
|
"6414100192 7639 179333.333333 5.25 \n",
|
|||
|
"5631500400 8062 90000.000000 3.00 \n",
|
|||
|
"2487200875 5000 151000.000000 7.00 \n",
|
|||
|
"1954400510 7503 170000.000000 5.00 \n",
|
|||
|
"... ... ... ... \n",
|
|||
|
"263000018 1509 120000.000000 5.50 \n",
|
|||
|
"6600060120 7200 100000.000000 6.50 \n",
|
|||
|
"1523300141 2007 201050.500000 2.75 \n",
|
|||
|
"291310100 1287 133333.333333 5.50 \n",
|
|||
|
"1523300157 1357 162500.000000 2.75 \n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 22 columns]\n",
|
|||
|
"\n",
|
|||
|
"Создание нового столбца 'is_expensive':\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0 3 1.00 1180 \n",
|
|||
|
"6414100192 20141209T000000 538000.0 3 2.25 2570 \n",
|
|||
|
"5631500400 20150225T000000 180000.0 2 1.00 770 \n",
|
|||
|
"2487200875 20141209T000000 604000.0 4 3.00 1960 \n",
|
|||
|
"1954400510 20150218T000000 510000.0 3 2.00 1680 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 20140521T000000 360000.0 3 2.50 1530 \n",
|
|||
|
"6600060120 20150223T000000 400000.0 4 2.50 2310 \n",
|
|||
|
"1523300141 20140623T000000 402101.0 2 0.75 1020 \n",
|
|||
|
"291310100 20150116T000000 400000.0 3 2.50 1600 \n",
|
|||
|
"1523300157 20141015T000000 325000.0 2 0.75 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition ... yr_built \\\n",
|
|||
|
"id ... \n",
|
|||
|
"7129300520 5650 1.0 0 0 3 ... 1955 \n",
|
|||
|
"6414100192 7242 2.0 0 0 3 ... 1951 \n",
|
|||
|
"5631500400 10000 1.0 0 0 3 ... 1933 \n",
|
|||
|
"2487200875 5000 1.0 0 0 5 ... 1965 \n",
|
|||
|
"1954400510 8080 1.0 0 0 3 ... 1987 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"263000018 1131 3.0 0 0 3 ... 2009 \n",
|
|||
|
"6600060120 5813 2.0 0 0 3 ... 2014 \n",
|
|||
|
"1523300141 1350 2.0 0 0 3 ... 2009 \n",
|
|||
|
"291310100 2388 2.0 0 0 3 ... 2004 \n",
|
|||
|
"1523300157 1076 2.0 0 0 3 ... 2008 \n",
|
|||
|
"\n",
|
|||
|
" yr_renovated zipcode lat long sqft_living15 \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 0 98178 47.5112 -122.257 1340 \n",
|
|||
|
"6414100192 1991 98125 47.7210 -122.319 1690 \n",
|
|||
|
"5631500400 0 98028 47.7379 -122.233 2720 \n",
|
|||
|
"2487200875 0 98136 47.5208 -122.393 1360 \n",
|
|||
|
"1954400510 0 98074 47.6168 -122.045 1800 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 0 98103 47.6993 -122.346 1530 \n",
|
|||
|
"6600060120 0 98146 47.5107 -122.362 1830 \n",
|
|||
|
"1523300141 0 98144 47.5944 -122.299 1020 \n",
|
|||
|
"291310100 0 98027 47.5345 -122.069 1410 \n",
|
|||
|
"1523300157 0 98144 47.5941 -122.299 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot15 price_per_bedroom total_rooms is_expensive \n",
|
|||
|
"id \n",
|
|||
|
"7129300520 5650 73966.666667 4.00 False \n",
|
|||
|
"6414100192 7639 179333.333333 5.25 True \n",
|
|||
|
"5631500400 8062 90000.000000 3.00 False \n",
|
|||
|
"2487200875 5000 151000.000000 7.00 True \n",
|
|||
|
"1954400510 7503 170000.000000 5.00 True \n",
|
|||
|
"... ... ... ... ... \n",
|
|||
|
"263000018 1509 120000.000000 5.50 True \n",
|
|||
|
"6600060120 7200 100000.000000 6.50 True \n",
|
|||
|
"1523300141 2007 201050.500000 2.75 True \n",
|
|||
|
"291310100 1287 133333.333333 5.50 True \n",
|
|||
|
"1523300157 1357 162500.000000 2.75 True \n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 23 columns]\n",
|
|||
|
"\n",
|
|||
|
"Создание нового столбца 'floor_area_ratio':\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0 3 1.00 1180 \n",
|
|||
|
"6414100192 20141209T000000 538000.0 3 2.25 2570 \n",
|
|||
|
"5631500400 20150225T000000 180000.0 2 1.00 770 \n",
|
|||
|
"2487200875 20141209T000000 604000.0 4 3.00 1960 \n",
|
|||
|
"1954400510 20150218T000000 510000.0 3 2.00 1680 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 20140521T000000 360000.0 3 2.50 1530 \n",
|
|||
|
"6600060120 20150223T000000 400000.0 4 2.50 2310 \n",
|
|||
|
"1523300141 20140623T000000 402101.0 2 0.75 1020 \n",
|
|||
|
"291310100 20150116T000000 400000.0 3 2.50 1600 \n",
|
|||
|
"1523300157 20141015T000000 325000.0 2 0.75 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition ... yr_renovated \\\n",
|
|||
|
"id ... \n",
|
|||
|
"7129300520 5650 1.0 0 0 3 ... 0 \n",
|
|||
|
"6414100192 7242 2.0 0 0 3 ... 1991 \n",
|
|||
|
"5631500400 10000 1.0 0 0 3 ... 0 \n",
|
|||
|
"2487200875 5000 1.0 0 0 5 ... 0 \n",
|
|||
|
"1954400510 8080 1.0 0 0 3 ... 0 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"263000018 1131 3.0 0 0 3 ... 0 \n",
|
|||
|
"6600060120 5813 2.0 0 0 3 ... 0 \n",
|
|||
|
"1523300141 1350 2.0 0 0 3 ... 0 \n",
|
|||
|
"291310100 2388 2.0 0 0 3 ... 0 \n",
|
|||
|
"1523300157 1076 2.0 0 0 3 ... 0 \n",
|
|||
|
"\n",
|
|||
|
" zipcode lat long sqft_living15 sqft_lot15 \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 98178 47.5112 -122.257 1340 5650 \n",
|
|||
|
"6414100192 98125 47.7210 -122.319 1690 7639 \n",
|
|||
|
"5631500400 98028 47.7379 -122.233 2720 8062 \n",
|
|||
|
"2487200875 98136 47.5208 -122.393 1360 5000 \n",
|
|||
|
"1954400510 98074 47.6168 -122.045 1800 7503 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 98103 47.6993 -122.346 1530 1509 \n",
|
|||
|
"6600060120 98146 47.5107 -122.362 1830 7200 \n",
|
|||
|
"1523300141 98144 47.5944 -122.299 1020 2007 \n",
|
|||
|
"291310100 98027 47.5345 -122.069 1410 1287 \n",
|
|||
|
"1523300157 98144 47.5941 -122.299 1020 1357 \n",
|
|||
|
"\n",
|
|||
|
" price_per_bedroom total_rooms is_expensive floor_area_ratio \n",
|
|||
|
"id \n",
|
|||
|
"7129300520 73966.666667 4.00 False 0.333333 \n",
|
|||
|
"6414100192 179333.333333 5.25 True 0.666667 \n",
|
|||
|
"5631500400 90000.000000 3.00 False 0.500000 \n",
|
|||
|
"2487200875 151000.000000 7.00 True 0.250000 \n",
|
|||
|
"1954400510 170000.000000 5.00 True 0.333333 \n",
|
|||
|
"... ... ... ... ... \n",
|
|||
|
"263000018 120000.000000 5.50 True 1.000000 \n",
|
|||
|
"6600060120 100000.000000 6.50 True 0.500000 \n",
|
|||
|
"1523300141 201050.500000 2.75 True 1.000000 \n",
|
|||
|
"291310100 133333.333333 5.50 True 0.666667 \n",
|
|||
|
"1523300157 162500.000000 2.75 True 1.000000 \n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 24 columns]\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# 1. Создание нового столбца 'price_per_bedroom'\n",
|
|||
|
"print(\"Создание нового столбца 'price_per_bedroom':\")\n",
|
|||
|
"data_frame[\"price_per_bedroom\"] = data_frame[\"price\"] / data_frame[\"bedrooms\"]\n",
|
|||
|
"print(data_frame)\n",
|
|||
|
"\n",
|
|||
|
"# 2. Создание нового столбца 'total_rooms' (сумма спален и ванных комнат)\n",
|
|||
|
"print(\"\\nСоздание нового столбца 'total_rooms':\")\n",
|
|||
|
"data_frame[\"total_rooms\"] = data_frame[\"bedrooms\"] + data_frame[\"bathrooms\"]\n",
|
|||
|
"print(data_frame)\n",
|
|||
|
"\n",
|
|||
|
"# 3. Создание нового столбца 'is_expensive' (определяем, дорогой ли дом)\n",
|
|||
|
"print(\"\\nСоздание нового столбца 'is_expensive':\")\n",
|
|||
|
"data_frame[\"is_expensive\"] = data_frame[\"price\"] > 300000\n",
|
|||
|
"print(data_frame)\n",
|
|||
|
"\n",
|
|||
|
"# 4. Создание нового столбца 'floor_area_ratio' (соотношение этажей к количеству спален)\n",
|
|||
|
"print(\"\\nСоздание нового столбца 'floor_area_ratio':\")\n",
|
|||
|
"data_frame[\"floor_area_ratio\"] = data_frame[\"floors\"] / data_frame[\"bedrooms\"]\n",
|
|||
|
"print(data_frame)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Удаление строк с пустыми значениями\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 38,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Исходный DataFrame с пустыми значениями:\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0 3 1.00 1180 \n",
|
|||
|
"6414100192 20141209T000000 538000.0 3 2.25 2570 \n",
|
|||
|
"5631500400 20150225T000000 180000.0 2 1.00 770 \n",
|
|||
|
"2487200875 20141209T000000 604000.0 4 3.00 1960 \n",
|
|||
|
"1954400510 20150218T000000 510000.0 3 2.00 1680 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 20140521T000000 360000.0 3 2.50 1530 \n",
|
|||
|
"6600060120 20150223T000000 400000.0 4 2.50 2310 \n",
|
|||
|
"1523300141 20140623T000000 402101.0 2 0.75 1020 \n",
|
|||
|
"291310100 20150116T000000 400000.0 3 2.50 1600 \n",
|
|||
|
"1523300157 20141015T000000 325000.0 2 0.75 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition ... yr_renovated \\\n",
|
|||
|
"id ... \n",
|
|||
|
"7129300520 5650 1.0 0 0 3 ... 0 \n",
|
|||
|
"6414100192 7242 2.0 0 0 3 ... 1991 \n",
|
|||
|
"5631500400 10000 1.0 0 0 3 ... 0 \n",
|
|||
|
"2487200875 5000 1.0 0 0 5 ... 0 \n",
|
|||
|
"1954400510 8080 1.0 0 0 3 ... 0 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"263000018 1131 3.0 0 0 3 ... 0 \n",
|
|||
|
"6600060120 5813 2.0 0 0 3 ... 0 \n",
|
|||
|
"1523300141 1350 2.0 0 0 3 ... 0 \n",
|
|||
|
"291310100 2388 2.0 0 0 3 ... 0 \n",
|
|||
|
"1523300157 1076 2.0 0 0 3 ... 0 \n",
|
|||
|
"\n",
|
|||
|
" zipcode lat long sqft_living15 sqft_lot15 \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 98178 47.5112 -122.257 1340 5650 \n",
|
|||
|
"6414100192 98125 47.7210 -122.319 1690 7639 \n",
|
|||
|
"5631500400 98028 47.7379 -122.233 2720 8062 \n",
|
|||
|
"2487200875 98136 47.5208 -122.393 1360 5000 \n",
|
|||
|
"1954400510 98074 47.6168 -122.045 1800 7503 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 98103 47.6993 -122.346 1530 1509 \n",
|
|||
|
"6600060120 98146 47.5107 -122.362 1830 7200 \n",
|
|||
|
"1523300141 98144 47.5944 -122.299 1020 2007 \n",
|
|||
|
"291310100 98027 47.5345 -122.069 1410 1287 \n",
|
|||
|
"1523300157 98144 47.5941 -122.299 1020 1357 \n",
|
|||
|
"\n",
|
|||
|
" price_per_bedroom total_rooms is_expensive floor_area_ratio \n",
|
|||
|
"id \n",
|
|||
|
"7129300520 73966.666667 4.00 False 0.333333 \n",
|
|||
|
"6414100192 179333.333333 5.25 True 0.666667 \n",
|
|||
|
"5631500400 90000.000000 3.00 False 0.500000 \n",
|
|||
|
"2487200875 151000.000000 7.00 True 0.250000 \n",
|
|||
|
"1954400510 170000.000000 5.00 True 0.333333 \n",
|
|||
|
"... ... ... ... ... \n",
|
|||
|
"263000018 120000.000000 5.50 True 1.000000 \n",
|
|||
|
"6600060120 100000.000000 6.50 True 0.500000 \n",
|
|||
|
"1523300141 201050.500000 2.75 True 1.000000 \n",
|
|||
|
"291310100 133333.333333 5.50 True 0.666667 \n",
|
|||
|
"1523300157 162500.000000 2.75 True 1.000000 \n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 24 columns]\n",
|
|||
|
"\n",
|
|||
|
"Удаление строк с любыми пустыми значениями:\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0 3 1.00 1180 \n",
|
|||
|
"6414100192 20141209T000000 538000.0 3 2.25 2570 \n",
|
|||
|
"5631500400 20150225T000000 180000.0 2 1.00 770 \n",
|
|||
|
"2487200875 20141209T000000 604000.0 4 3.00 1960 \n",
|
|||
|
"1954400510 20150218T000000 510000.0 3 2.00 1680 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 20140521T000000 360000.0 3 2.50 1530 \n",
|
|||
|
"6600060120 20150223T000000 400000.0 4 2.50 2310 \n",
|
|||
|
"1523300141 20140623T000000 402101.0 2 0.75 1020 \n",
|
|||
|
"291310100 20150116T000000 400000.0 3 2.50 1600 \n",
|
|||
|
"1523300157 20141015T000000 325000.0 2 0.75 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition ... yr_renovated \\\n",
|
|||
|
"id ... \n",
|
|||
|
"7129300520 5650 1.0 0 0 3 ... 0 \n",
|
|||
|
"6414100192 7242 2.0 0 0 3 ... 1991 \n",
|
|||
|
"5631500400 10000 1.0 0 0 3 ... 0 \n",
|
|||
|
"2487200875 5000 1.0 0 0 5 ... 0 \n",
|
|||
|
"1954400510 8080 1.0 0 0 3 ... 0 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"263000018 1131 3.0 0 0 3 ... 0 \n",
|
|||
|
"6600060120 5813 2.0 0 0 3 ... 0 \n",
|
|||
|
"1523300141 1350 2.0 0 0 3 ... 0 \n",
|
|||
|
"291310100 2388 2.0 0 0 3 ... 0 \n",
|
|||
|
"1523300157 1076 2.0 0 0 3 ... 0 \n",
|
|||
|
"\n",
|
|||
|
" zipcode lat long sqft_living15 sqft_lot15 \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 98178 47.5112 -122.257 1340 5650 \n",
|
|||
|
"6414100192 98125 47.7210 -122.319 1690 7639 \n",
|
|||
|
"5631500400 98028 47.7379 -122.233 2720 8062 \n",
|
|||
|
"2487200875 98136 47.5208 -122.393 1360 5000 \n",
|
|||
|
"1954400510 98074 47.6168 -122.045 1800 7503 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 98103 47.6993 -122.346 1530 1509 \n",
|
|||
|
"6600060120 98146 47.5107 -122.362 1830 7200 \n",
|
|||
|
"1523300141 98144 47.5944 -122.299 1020 2007 \n",
|
|||
|
"291310100 98027 47.5345 -122.069 1410 1287 \n",
|
|||
|
"1523300157 98144 47.5941 -122.299 1020 1357 \n",
|
|||
|
"\n",
|
|||
|
" price_per_bedroom total_rooms is_expensive floor_area_ratio \n",
|
|||
|
"id \n",
|
|||
|
"7129300520 73966.666667 4.00 False 0.333333 \n",
|
|||
|
"6414100192 179333.333333 5.25 True 0.666667 \n",
|
|||
|
"5631500400 90000.000000 3.00 False 0.500000 \n",
|
|||
|
"2487200875 151000.000000 7.00 True 0.250000 \n",
|
|||
|
"1954400510 170000.000000 5.00 True 0.333333 \n",
|
|||
|
"... ... ... ... ... \n",
|
|||
|
"263000018 120000.000000 5.50 True 1.000000 \n",
|
|||
|
"6600060120 100000.000000 6.50 True 0.500000 \n",
|
|||
|
"1523300141 201050.500000 2.75 True 1.000000 \n",
|
|||
|
"291310100 133333.333333 5.50 True 0.666667 \n",
|
|||
|
"1523300157 162500.000000 2.75 True 1.000000 \n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 24 columns]\n",
|
|||
|
"\n",
|
|||
|
"Удаление строк с пустыми значениями в столбце 'price':\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0 3 1.00 1180 \n",
|
|||
|
"6414100192 20141209T000000 538000.0 3 2.25 2570 \n",
|
|||
|
"5631500400 20150225T000000 180000.0 2 1.00 770 \n",
|
|||
|
"2487200875 20141209T000000 604000.0 4 3.00 1960 \n",
|
|||
|
"1954400510 20150218T000000 510000.0 3 2.00 1680 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 20140521T000000 360000.0 3 2.50 1530 \n",
|
|||
|
"6600060120 20150223T000000 400000.0 4 2.50 2310 \n",
|
|||
|
"1523300141 20140623T000000 402101.0 2 0.75 1020 \n",
|
|||
|
"291310100 20150116T000000 400000.0 3 2.50 1600 \n",
|
|||
|
"1523300157 20141015T000000 325000.0 2 0.75 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition ... yr_renovated \\\n",
|
|||
|
"id ... \n",
|
|||
|
"7129300520 5650 1.0 0 0 3 ... 0 \n",
|
|||
|
"6414100192 7242 2.0 0 0 3 ... 1991 \n",
|
|||
|
"5631500400 10000 1.0 0 0 3 ... 0 \n",
|
|||
|
"2487200875 5000 1.0 0 0 5 ... 0 \n",
|
|||
|
"1954400510 8080 1.0 0 0 3 ... 0 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"263000018 1131 3.0 0 0 3 ... 0 \n",
|
|||
|
"6600060120 5813 2.0 0 0 3 ... 0 \n",
|
|||
|
"1523300141 1350 2.0 0 0 3 ... 0 \n",
|
|||
|
"291310100 2388 2.0 0 0 3 ... 0 \n",
|
|||
|
"1523300157 1076 2.0 0 0 3 ... 0 \n",
|
|||
|
"\n",
|
|||
|
" zipcode lat long sqft_living15 sqft_lot15 \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 98178 47.5112 -122.257 1340 5650 \n",
|
|||
|
"6414100192 98125 47.7210 -122.319 1690 7639 \n",
|
|||
|
"5631500400 98028 47.7379 -122.233 2720 8062 \n",
|
|||
|
"2487200875 98136 47.5208 -122.393 1360 5000 \n",
|
|||
|
"1954400510 98074 47.6168 -122.045 1800 7503 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 98103 47.6993 -122.346 1530 1509 \n",
|
|||
|
"6600060120 98146 47.5107 -122.362 1830 7200 \n",
|
|||
|
"1523300141 98144 47.5944 -122.299 1020 2007 \n",
|
|||
|
"291310100 98027 47.5345 -122.069 1410 1287 \n",
|
|||
|
"1523300157 98144 47.5941 -122.299 1020 1357 \n",
|
|||
|
"\n",
|
|||
|
" price_per_bedroom total_rooms is_expensive floor_area_ratio \n",
|
|||
|
"id \n",
|
|||
|
"7129300520 73966.666667 4.00 False 0.333333 \n",
|
|||
|
"6414100192 179333.333333 5.25 True 0.666667 \n",
|
|||
|
"5631500400 90000.000000 3.00 False 0.500000 \n",
|
|||
|
"2487200875 151000.000000 7.00 True 0.250000 \n",
|
|||
|
"1954400510 170000.000000 5.00 True 0.333333 \n",
|
|||
|
"... ... ... ... ... \n",
|
|||
|
"263000018 120000.000000 5.50 True 1.000000 \n",
|
|||
|
"6600060120 100000.000000 6.50 True 0.500000 \n",
|
|||
|
"1523300141 201050.500000 2.75 True 1.000000 \n",
|
|||
|
"291310100 133333.333333 5.50 True 0.666667 \n",
|
|||
|
"1523300157 162500.000000 2.75 True 1.000000 \n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 24 columns]\n",
|
|||
|
"\n",
|
|||
|
"Удаление строк, где все значения пустые:\n",
|
|||
|
" date price bedrooms bathrooms sqft_living \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 20141013T000000 221900.0 3 1.00 1180 \n",
|
|||
|
"6414100192 20141209T000000 538000.0 3 2.25 2570 \n",
|
|||
|
"5631500400 20150225T000000 180000.0 2 1.00 770 \n",
|
|||
|
"2487200875 20141209T000000 604000.0 4 3.00 1960 \n",
|
|||
|
"1954400510 20150218T000000 510000.0 3 2.00 1680 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 20140521T000000 360000.0 3 2.50 1530 \n",
|
|||
|
"6600060120 20150223T000000 400000.0 4 2.50 2310 \n",
|
|||
|
"1523300141 20140623T000000 402101.0 2 0.75 1020 \n",
|
|||
|
"291310100 20150116T000000 400000.0 3 2.50 1600 \n",
|
|||
|
"1523300157 20141015T000000 325000.0 2 0.75 1020 \n",
|
|||
|
"\n",
|
|||
|
" sqft_lot floors waterfront view condition ... yr_renovated \\\n",
|
|||
|
"id ... \n",
|
|||
|
"7129300520 5650 1.0 0 0 3 ... 0 \n",
|
|||
|
"6414100192 7242 2.0 0 0 3 ... 1991 \n",
|
|||
|
"5631500400 10000 1.0 0 0 3 ... 0 \n",
|
|||
|
"2487200875 5000 1.0 0 0 5 ... 0 \n",
|
|||
|
"1954400510 8080 1.0 0 0 3 ... 0 \n",
|
|||
|
"... ... ... ... ... ... ... ... \n",
|
|||
|
"263000018 1131 3.0 0 0 3 ... 0 \n",
|
|||
|
"6600060120 5813 2.0 0 0 3 ... 0 \n",
|
|||
|
"1523300141 1350 2.0 0 0 3 ... 0 \n",
|
|||
|
"291310100 2388 2.0 0 0 3 ... 0 \n",
|
|||
|
"1523300157 1076 2.0 0 0 3 ... 0 \n",
|
|||
|
"\n",
|
|||
|
" zipcode lat long sqft_living15 sqft_lot15 \\\n",
|
|||
|
"id \n",
|
|||
|
"7129300520 98178 47.5112 -122.257 1340 5650 \n",
|
|||
|
"6414100192 98125 47.7210 -122.319 1690 7639 \n",
|
|||
|
"5631500400 98028 47.7379 -122.233 2720 8062 \n",
|
|||
|
"2487200875 98136 47.5208 -122.393 1360 5000 \n",
|
|||
|
"1954400510 98074 47.6168 -122.045 1800 7503 \n",
|
|||
|
"... ... ... ... ... ... \n",
|
|||
|
"263000018 98103 47.6993 -122.346 1530 1509 \n",
|
|||
|
"6600060120 98146 47.5107 -122.362 1830 7200 \n",
|
|||
|
"1523300141 98144 47.5944 -122.299 1020 2007 \n",
|
|||
|
"291310100 98027 47.5345 -122.069 1410 1287 \n",
|
|||
|
"1523300157 98144 47.5941 -122.299 1020 1357 \n",
|
|||
|
"\n",
|
|||
|
" price_per_bedroom total_rooms is_expensive floor_area_ratio \n",
|
|||
|
"id \n",
|
|||
|
"7129300520 73966.666667 4.00 False 0.333333 \n",
|
|||
|
"6414100192 179333.333333 5.25 True 0.666667 \n",
|
|||
|
"5631500400 90000.000000 3.00 False 0.500000 \n",
|
|||
|
"2487200875 151000.000000 7.00 True 0.250000 \n",
|
|||
|
"1954400510 170000.000000 5.00 True 0.333333 \n",
|
|||
|
"... ... ... ... ... \n",
|
|||
|
"263000018 120000.000000 5.50 True 1.000000 \n",
|
|||
|
"6600060120 100000.000000 6.50 True 0.500000 \n",
|
|||
|
"1523300141 201050.500000 2.75 True 1.000000 \n",
|
|||
|
"291310100 133333.333333 5.50 True 0.666667 \n",
|
|||
|
"1523300157 162500.000000 2.75 True 1.000000 \n",
|
|||
|
"\n",
|
|||
|
"[21613 rows x 24 columns]\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# 1. Исходный DataFrame с пустыми значениями\n",
|
|||
|
"print(\"Исходный DataFrame с пустыми значениями:\")\n",
|
|||
|
"print(data_frame)\n",
|
|||
|
"\n",
|
|||
|
"# 2. Удаление строк с любыми пустыми значениями\n",
|
|||
|
"print(\"\\nУдаление строк с любыми пустыми значениями:\")\n",
|
|||
|
"print(data_frame.dropna())\n",
|
|||
|
"\n",
|
|||
|
"# 3. Удаление строк только с пустыми значениями в определенном столбце (например, 'price')\n",
|
|||
|
"print(\"\\nУдаление строк с пустыми значениями в столбце 'price':\")\n",
|
|||
|
"print(data_frame.dropna(subset=[\"price\"]))\n",
|
|||
|
"\n",
|
|||
|
"# 4. Удаление строк, где все значения пустые\n",
|
|||
|
"print(\"\\nУдаление строк, где все значения пустые:\")\n",
|
|||
|
"print(data_frame.dropna(how=\"all\"))"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Matplotlib\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 39,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjcAAAHKCAYAAAD/zGr0AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABJaUlEQVR4nO3dd1yV9f//8ecBWcpwoOAg0ajEbViGIxsoWuZoaKmhpmalWfkti0rRsrChYeVITe1Tmqvlp+EiyYW5R7kVRyq4t0LC+/eHP8/HI4gcRQ5ePu6323W7eb2v9/W+Xmd4zpNrHZsxxggAAMAi3FxdAAAAQH4i3AAAAEsh3AAAAEsh3AAAAEsh3AAAAEsh3AAAAEsh3AAAAEsh3AAAAEsh3AAAAEsh3AAAAEsh3OC62rZtm3r06KHKlSvL29tb/v7+atCggYYNG6YzZ864ujwAgAUVcXUBsK5ffvlFTzzxhLy8vBQTE6Pq1asrIyNDCxcu1Guvvaa///5bo0ePdnWZAACLsfHDmbgeUlJSVLNmTVWoUEG///67ypYt67B869at+uWXX/TSSy+5qEIAgFVxWArXxYcffqiTJ0/qyy+/zBZsJCksLMwh2NhsNvXq1UsTJ07UHXfcIW9vb0VERGj+/PnZ1t2zZ4+eeeYZBQUFycvLS9WqVdO4ceNyrGPAgAGy2WzZpvvuu8+h33333afq1atnW//jjz+WzWbTjh077G3nzp3ToEGDdPvtt8vLy8th3OXLlzvdLyedO3eWr69vtvbp06fLZrMpKSnJoT09PV1xcXEKCwuTl5eXQkJC1LdvX6Wnpzv0u/A8X6pFixYKDQ3N9tjr16+vUqVKycfHRxEREZo+fXqudV9w33335fi8X5gufj4lacSIEapWrZq8vLxUrlw59ezZU0ePHr3idi68vhebN2+evLy89Nxzzzm0r1q1Ss2bN5e/v798fX314IMPasmSJU7VP2HCBIc+l76Pli1bZu97QVJSUo6vWefOnbM951lZWUpISFC1atXk7e2toKAg9ejRQ0eOHMlW42+//abGjRvLz89P/v7+uuuuuzRp0qRc6794uuDiNnd3d5UvX17PPvus/fk/efKkihUrluMfIv/884/c3d0VHx+f4/N48eMaNmyYatSoIW9vb5UuXVrNmjVz+H+QW63X8t6cMGFCnj4Djh49qpdfflkhISHy8vJSWFiYPvjgA2VlZdn77NixQzabTR9//HG27VSvXj3bmHAdDkvhuvjvf/+rypUrq379+nle548//tCUKVPUu3dveXl5acSIEWrWrJmWLl1qDx5paWm655577F/SpUuX1m+//aauXbvq+PHjevnll3Mce+TIkfawEBsbe02PbciQIerXr5/atGmj119/XV5eXlqwYEG2Q2x57XetsrKy1LJlSy1cuFDPPvuswsPDtW7dOn3yySfavHmzfvzxx6sad9iwYWrZsqU6dOigjIwMTZ48WU888YR+/vlnPfzww1dcv0KFCtm+9H799Vd9++23Dm0DBgzQwIEDFRUVpeeff16bNm3SyJEjtWzZMi1atEgeHh55rnnNmjVq3bq1HnroIQ0fPtze/vfff6tRo0by9/dX37595eHhoS+++EL33Xef/vjjD9WrVy/bWFWqVNFbb70lSTp48KBeeeWVK27/9ddfz3OtOenRo4cmTJigLl26qHfv3kpJSdHnn3+uVatWOTwXEyZM0DPPPKNq1aopNjZWxYsX16pVqzRz5ky1b99eb731lrp16+ZQ+7PPPqtGjRrluN02bdro0Ucf1blz55ScnKzRo0frzJkz+vrrr+Xr66s2bdpoypQpGjp0qNzd3e3rffvttzLGqEOHDrk+rq5du2rChAlq3ry5unXrpnPnzmnBggVasmSJ6tata+/XpEkTxcTEOKw7ZMiQbOHuat6bn3zyiQIDAyVJ7733nsOy06dPq3HjxtqzZ4969OihW265RYsXL1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99pzZo1evDBB+3Lo6KiVK5cOU2cONHe9tdff2nt2rXq2LFjrmN/9913stlsiouLy7bsaut15r2ZkZEhSbm+ntOmTVOjRo1UokQJh+c+KipKmZmZ2Q6PX3i+Lp4yMzOv6rHg+ripD0vNnz9fH330kVasWKF9+/bphx9+UOvWrZ0awxijIUOGaPTo0dq5c6cCAwP1wgsv2Hdn34z8/f0lnf9yd8Ztt92Wre3222/X6dOndeDAAbm5ueno0aMaPXr0ZQ/t7N+/32H+4MGD8vDwUNGiRa+4/Y0bN6p06dJX7BcZGamxY8fqiy++UIsWLeTl5aWTJ09edb9rtWXLFm3YsOGytV/6nHz55Zf68ssvs/WrWLGiw/zPP/+sQYMGafXq1Q7n7uRnWNu5c6ck6Y477nBo9/T0VOXKle3Lr6RFixbatGmTypQpI3PJNRIHDhzQ6dOns21DksLDw5WVlaXdu3erWrVq9vajR49mez5yM3HiRP3999+aOnWq/byXCypXrqzg4GB9/PHHqlWrlsqVKydJ2c6H2rJli44dO2YPQ5e68Dpu27ZNknI8R+xqffTRR/roo4/s882aNdMHH3xgn3dzc1OHDh00cuRInT59WkWLFtXEiRPl7e2tJ554Itext23bpnLlyqlkyZL5Vq8z780L5w7ldA7bBVu2bNHatWvz/H8oLi4ux7AWFBSUl/JRAG7qcHPq1CnVqlVLzzzzjB599NGrGuOll17S7Nmz9fHHH6tGjRo6fPiwDh8+nM+V3lj8/f1Vrlw5/fXXX/k67oUT+zp27KhOnTrl2KdmzZoO8zt27NAtt9ySpy/k0NBQjRkzxqFt2rRp2YJUfHy89uzZk+2E1Uvltd+1ysrKUo0aNTR06NAcl4eEhDjMt2rVKttJxW+//bZSU1Pt8wsWLFDLli117733asSIESpbtqw8PDw0fvz4bF/ehcHGjRv122+/qW3btvq///s/jR8//pr
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
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Jf/jDHyRJx44d05o1azRkyBCFhoYqOztbr776qu644w59+eWXCg4OdpjT29tbSUlJmj9/vr3trbfekqenpwoLC0v8fDw8PHTw4EF9/vnn6tSpk709OTlZ3t7eJcYvWrRIN998s/74xz/Kw8ND69at0+OPPy6r1ar4+PgS48vKarXqj3/8oz766CONHDlSbdq0UUZGhubOnasjR45ozZo1TjsWcMOyAaiSkpKSbJJse/fuvaZxx48ft9lsNlthYaGtUaNGtv79+9sk2ZKSkuxje/bsaatZs6btxIkTDnNYrdarzt24cWNbbGxsifZLly7ZAgICbO3atbP9+OOP9vb169fbJNmmTp1qb4uNjbX5+vr+5hoaN25sk2R7//337W15eXm2Bg0a2Dp16mRvKywstBUXFzvse/z4cZuXl5ft2Weftbdt377dJsl2//332+rWrWsrKiqy97Vo0cL2l7/8xSbJtnLlyhJ1Dhw40JaQkGBv//DDD20+Pj62QYMGlVjHxYsXS6wlKirK1rRp099c7y+P979Wrlxpk2Tbvn27ve2dd96xubm52T788EOHsYsXL7ZJsu3atcveJskWHx9fYt7o6Ghb48aNf7cu4EbFJTMADl555RV99913mjZtmkP72bNntXPnTsXFxalRo0YOfRaLpVTH+PTTT5WTk6PHH3/c4cxJdHS0WrdurQ0bNpS67uDgYN199932z35+fnrooYf0+eefKysrS9LPZ5rc3H7+v73i4mJ99913qlGjhlq1aqXPPvusxJwDBw6UxWLR2rVrJUkffvihvvnmG913332/WkdcXJyWLVtmvxSVlJSke+65R/7+/iXG+vj42P+cl5enc+fO6Y477tCxY8eUl5dX6p/Br1m5cqXatGmj1q1b69y5c/atT58+kqTt27c7jC8sLHQYd+7cOV2+fNlp9QCVEYEIgF1eXp5mzZqlsWPHKjAw0KHv2LFjkqR27dpd93FOnDghSWrVqlWJvtatW9v7S6N58+YlglnLli0lyX5/lNVq1dy5c9WiRQt5eXmpXr16ql+/vr744ourBpBq1arpgQce0JtvvilJevPNNzV48GD5+fn9ah3R0dHy8PDQBx98oIKCAq1YsULDhw+/6thdu3YpMjJSvr6+qlWrlurXr6+nnnpKkpwaiI4ePaqDBw+qfv36DtuVn09OTo7D+DfeeKPE2C1btjitHqAy4h4iAHazZ8+Wm5ubJkyYoO+++87V5TjdrFmz9MwzzyguLk5///vfVadOHbm5uWn06NGyWq1X3ScuLk6dOnVSZmamVq5caT9b9GuuhKikpCRdvHhRdevWVZ8+ffTOO+84jPv666/Vt29ftW7dWi+99JJCQkLk6emp//znP5o7d+6v1lMWVqtVYWFheumll67aHxIS4vD5T3/6U4kbq59++mn7mTagKiIQAZAknTlzRvPnz1diYqJq1qxZIhA1bdpUknTgwIHrPlbjxo0lSZmZmfbLNldkZmba+0vjq6++ks1mczhLdOTIEUmyPx21atUq9e7dW2+88YbDvrm5uapXr95V5w0LC1OnTp3sT9b17t1bO3bs+M1a4uLi1KFDB506dUqxsbFXvaS4bt06FRUVae3atQ6XIP/38pUzNGvWTPv371ffvn2v6fJmw4YNFRkZ6dA2b948AhGqNC6ZAZAkzZgxQ4GBgXr00Uev2l+/fn317NlTb775pk6ePOnQZ7PZSnWs8PBwBQQEaPHixQ6PfW/cuFGHDh1SdHR0qes/c+aMVq9ebf+cn5+vt99+Wx07dlRQUJAkyd3dvUStK1euLPGo//+Ki4vTF198YX+0/vfcfPPN6tKli7788ksNGzbsqmPc3d0lOf7s8vLylJSU9Lvzl9a9996r06dP67XXXivR9+OPP6qgoMDpxwRuNJwhAiBJ2rJli5YuXSpPT89fHbNgwQLdfvvt6ty5s0aOHKnQ0FD997//1YYNG0q8r+e3VKtWTbNnz9bw4cN1xx136P7777c/dt+kSRONGTOm1PW3bNlSI0aM0N69exUYGKg333xT2dnZDgFjwIABevbZZzV8+HDddtttysjI0NKlS+1nv37NI488oiFDhlz1xuhfs23bNhUVFf3qG8H79esnT09PDRw4UH/961914cIFvfbaawoICNC33357TccoLi7Wpk2bHNqu/D3s2bNHDRs2VPPmzfXggw9qxYoVevTRR7V9+3Z1795dxcXFOnz4sFasWKHNmzfz8k4Yj0AEQJLUsWNH3X///b85pkOHDvrkk0/0zDPPaNGiRSosLFTjxo117733lvp4w4YNU/Xq1fX8889r4sSJ8vX11d13363Zs2c7vIPoWrVo0UIvv/yyJkyYoMzMTIWGhmr58uWKioqyj3nqqadUUFCgZcuWafny5ercubM2bNigSZMm/ebcHh4ev3pJ7df4+vrK19f3V/tbtWqlVatW6emnn9b48eMVFBSkxx57TPXr11dcXNw1HaOwsFD9+/e/at/EiRN18eJFTZ8+XW5ublqzZo3mzp2rt99+W6tXr1b16tXVtGlTjRo1yn5zNWAyi62057oBoJJp0qSJ2rVrp/Xr17u6lEqjV69e6tWrl6ZPn+7qUoAbAvcQAQAA4xGIAKAKuvXWWx2+RgXAb+MeIgCogubMmePqEoAbCvcQAQAA43HJDAAAGI9ABAAAjMc9RNfAarXqzJkzqlmzZqm/1RsAALiGzWbTDz/8oODgYLm5/fY5IALRNThz5kyJLz8EAAA3hlOnTqlhw4a/OYZAdA1q1qwp6ecfqJ+fn4urAQAA1yI/P18hISH23+O/hUB0Da5cJvPz8yMQAQBwg7mW2124qRoAABiPQAQAAIxHIAIAAMYjEAEAAOMRiAAAgPEIRAAAwHgEIgAAYDwCEQAAMB6BCAAAGI9ABAAAjEcgAgAAxiMQAQAA4xGIAACA8QhEAADAeAQiAABgPA9XF4DrlDqw7Pv2Wue8OgAAuIFxhggAABi
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAG9CAYAAAARC6x6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACqS0lEQVR4nOzdeVhU5dsH8O8wAwOyibIoi4CiooIaWu7ghia4EGKL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09ZsyYoXLO2dkZN2/e1Hp/ob+fvLw8HDlyBJMmTUKrVq0UYmh7T2hTUVGB/Px85OXl4fjx49izZw86d+7Mt6AKfT9pU1ZWhvz8fNy7dw9JSUk4dOgQBg0apFBG/n328OFDFBQUoF+/fjh9+rRKvCdPnqi8PisqKtQ+dklJiUpZmUymtuzjx4+Rn5+PR48e6XxOQHXX2OLFi/Htt99i6NChyM/Pxw8//ACJRHgHx/r167Fs2TJ89tlnGDVqlMI57j0QGRmpcDwqKgoAsHfvXoXjtfn84Z6z/I8yqVTKf2bLZDLcv38fNjY2aN++vdrfz9PIZBKeI0eOYMSIEXB1dYVIJEJ8fHyNYzDGsGrVKrRr1w5SqRRubm745JNP9FrPTp06Yd++fWjTpg3c3d2RlJSEpKQk9OjRQ6+PI6+goABLly5FZGQkXFxc1JYpLi7G0KFDkZubiwcPHgj+YM7OzlZoQq+J1157DdevX+ebzP/44w/k5uZi/PjxCvFdXV0VvmzV+fPPPzF48GB+jImTkxPmz58PACoJDwBMnDgR+/fvx507d5CSkoI7d+7
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAioAAAHHCAYAAACRAnNyAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABvlElEQVR4nO3deXxTVfo/8M+5WW7SlZYdQQQRVEARV3CBURQVFHRGlK8LiuIyqPhVR2Xc9aegM477voCjfhU33HBFBBzFERcEUVGgQJXuWdpma3LP+f1RExtaoClJb5bP21dekpube5/cpO2TszxHKKUUiIiIiNKQZnYARERERNvDRIWIiIjSFhMVIiIiSltMVIiIiChtMVEhIiKitMVEhYiIiNIWExUiIiJKW0xUiIiIKG0xUSEiIqK0xUSFiIgoAQ899BA8Hk/s/n333Qefz2deQFmOiUoO2rBhAy666CIMHDgQDocDRUVFOPzww3H//fcjEAiYHR4RUVp7++23ccstt6C8vBwvvPACbrzxRjidTrPDylqCa/3klkWLFuG0006Drus455xzMGzYMDQ1NeE///kPXnvtNZx77rl44oknzA6TiChtLVu2DCeffDLq6+uhaRruueceXHHFFWaHlbWYqOSQsrIy7Lfffujbty+WLFmC3r17xz2+fv16LFq0CLNmzTIpQiKizODxePDjjz+iX79+6Nu3r9nhZDV2/eSQu+++G42NjXj66adbJSkAMGjQoFiSMmbMGOy///5tHmfIkCEYP348AGDTpk0QQkAIgTfeeCNuv2AwiJKSEggh8M9//jO2/ZZbboEQAj169EA4HI57zosvvhg7Xm1tbWz7m2++iQkTJqBPnz7QdR177rknbr/9dhiGEff8sWPHYtiwYfj6668xevRoOJ1ODBgwAI899ljcfkuXLoUQAq+++mqr11dQUIBzzz03dt/lcuHqq6/G8OHDUVBQgKKiIpxwwgn47rvvWj1348aNOO2009CnTx9omhZ7LcOGDWvzWrYkhMCll17aavvEiROxxx57tNr+008/4S9/+QtKS0vhcDhw0EEH4a233orbZ/78+RBC4KuvvorbXltbCyEEbrnllti2zZs3469//SuGDBkCp9OJrl274rTTTsOmTZt2GnvLz0Fbt7Fjx8btX11djfPPPx89e/aEw+HA/vvvj2effXan5wGAPfbYI+79AYALL7wQDocDS5cujdv+yCOPYOjQodB1HX369MHMmTPjxha0J/5t95k/f37cc2fOnAkhRFxM5557bpvv2bbXHAB+++03TJ8+HT179oSu6xg6dCieeeaZVs8NBoO45ZZbMHjwYDgcDvTu3RunnnoqNmzYsNPr3zK+6GciesvLy8Pw4cPx1FNPxc41b948CCHw7bfftorjzjvvhMViwW+//dbqMQBoaGjABRdcgP79+0PXdfTt2xcXX3wxqqqqYvtsG0Nbt+h1Xr16Nc4999xYV3WvXr0wffp01NXVxZ139uzZcDgc+Oyzz2Lboj/nLT8Xn332GRwOB2bPnp3w+9DyeF26dMGoUaPQt29fTJgwoc33lpLDanYA1HnefvttDBw4EKNHj97pvmeffTZmzJiB77//Pu6P7MqVK/Hzzz/jhhtuiNvf4XBg3rx5mDx5cmzb66+/jmAwuN1zNDQ04J133sEpp5wS2zZv3jw4HI5Wz5s/fz4KCgpw5ZVXoqCgAEuWLMFNN92E+vp6/OMf/4jb1+1248QTT8SUKVMwdepUvPzyy7jkkktgt9sxffr0nb72bW3cuBFvvPEGTjvtNAwYMABVVVV4/PHHMWbMGPzwww/o06cPAMAwDJx88snYvHkzrrjiCgwePBhCCNxxxx0Jn3Nn1q5di8MPPxy77bYbrrvuOuTn5+Pll1/G5MmT8dprr8Vd0/ZauXIlPv/8c5xxxhno27cvNm3ahEcffRRjx47FDz/8gLy8vJ0eY+rUqTjxxBPjtm37ByEQCGDs2LFYv349Lr30UgwYMACvvPIKzj33XHg8noRb9G6++WY8/fTTWLBgQVxCdMstt+DWW2/FuHHjcMkll2DdunV49NFHsXLlSnz22Wew2WytjnXhhRfiyCOPBND8+V24cOEOz71+/Xo8+eSTCcXbUlVVFQ477LBYktq9e3e89957OP/881FfXx/rTjAMAxMnTsTHH3+MM844A7NmzUJDQwM++ugjfP/99xg3bhyee+652HGjsbfctueee8ad+95770W3bt1QX1+PZ555BjNmzMAee+yBcePG4S9/+QtmzpyJF154AQcccEDc81544QWMHTsWu+22W5uvyeVyYfXq1bjgggvQq1cvrF+/Ho899hjef/99fPnll+jRoweOOuqouNiiPyPXX399bFv099RHH32EjRs34rzzzkOvXr2wdu1aPPHEE1i7di2++OKLWDJ555134pdffsEpp5yC//73vxgwYECr2MrKyjB58mRMnDgRd955Z8LvQ1uWL1+Od999d7uPUxIoygler1cBUJMmTWrX/h6PRzkcDnXttdfGbb/88stVfn6+amxsVEopVVZWpgCoqVOnKqvVqiorK2P7HnPMMep//ud/FAD1j3/8I7b95ptvjj1n4sSJse2bN29WmqapqVOnKgCqpqYm9pjf728V40UXXaTy8vJUMBiMbRszZowCoO65557YtlAopEaMGKF69OihmpqalFJKffLJJwqAeuWVV1odNz8/X02bNi12PxgMKsMw4vYpKytTuq6r2267LbZt3bp1CoCaM2dO3L5jxoxRQ4cObXWebQFQM2fObLV9woQJqn///nHbjjnmGDV8+PC41y6lVKNHj1Z77bVXbNu8efMUALVy5cq459fU1CgA6uabb45ta+sar1ixQgFQ//73v3cYe/Rz0PJ9jho6dKgaM2ZM7P59992nAKjnn38+tq2pqUmNGjVKFRQUqPr6+h2eq3///rH35/HHH1cA1IMPPhi3T3V1tbLb7eq4446Le+8eeughBUA988wzcfv/8ssvCoB69tlnY9uin9NtX+O8efNi26ZMmaKGDRum+vXrF/eZOe+889Tuu+/eKvZtr/n555+vevfurWpra+P2O+OMM1RxcXHsPXnmmWcUAPWvf/2r1TGllK22bRt7S9HPRFlZWWzbzz//rACou+++O7Zt6tSpqk+fPnHX75tvvml1Ddrj+++/V7quq+nTp7f5+JgxY+I+Iy219bl88cUXFQC1fPnyuO0+n08ddNBBaujQocrr9cZ+zj/55BPl8XjUvvvuqw4++OBWx2zv+9DyeFGHHnqoOuGEE1q9t5Q87PrJEfX19QCAwsLCdu1fXFyMSZMm4cUXX4T6fRiTYRhYsGABJk+ejPz8/Lj9R44ciaFDh8a+JW3evBmffPJJqyb6lqZPn473338flZWVAIBnn30Wo0aNwuDBg1vt23JEfUNDA2pra3HkkUfC7/fjp59+itvXarXioosuit232+246KKLUF1dja+//jpu3+ixWt62pes6NE2LXYO6ujoUFBRgyJAh+Oabb+KOBQBdu3bd7mtOBpfLhSVLlmDKlClx8dfV1WH8+PH45ZdfWjXLe73euNfocrlaHbflNQ6Hw6irq8OgQYPQpUuXuNe5q95991306tULU6dOjW2z2Wy4/PLL0djYiGXLlrXrOG+++Sb++te/4m9/+1urLrPFixejqakJV1xxRey9A4AZM2agqKgIixYtitu/qakJQPN73V5ff/01XnnlFcyZMyfuHADQo0cPVFdXx47bFqUUXnvtNZx00klQSsW9P+PHj4fX641d99deew3dunXDZZdd1uo4LbunEuF2u1FbW4uNGzfi3nvvhcViwZgxY2KPn3POOdi6dSs++eST2LYXXngBTqcTf/7zn3d4bCll3Ovp2bMnTjzxRLz22muQUiYUZ8vPZTAYRG1tLQ477DAAaPW5zMvLw9tvvw2Xy4UpU6bEuoYNw8Dpp58Ot9uNt956K+6YibwP23r99dexcuVKzJ07N6HXRInJmkRl+fLlOOmkk9CnT582x0u0x8svv4wRI0YgLy8P/fv3b9WlkMmKioo
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjkAAAHHCAYAAABdm0mZAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACwZUlEQVR4nOzdeXycZbk//s+zzj6TyWRv0zQtbWlDFwpUKbJoQSwguFFFPLKc4/EoKOpPj3L0K6BiD8d9O7ieUsGtKogiClg2KUuhtKWENt3SJE2zZ/blWe/fH3fnaSZbkzTtJOn1fr3ygkwmk3smaZ4r930tAmOMgRBCCCFkhhGLvQBCCCGEkJOBghxCCCGEzEgU5BBCCCFkRqIghxBCCCEzEgU5hBBCCJmRKMghhBBCyIxEQQ4hhBBCZiQKcgghhBAyI1GQQwghhJAZiYIcQgghhMxIFOTMcH/4wx8gCMKwb2eddVaxl0fIlHLjjTfC7/eP+HFBEHDrrbeewhVNPffdd9+Iv1PodwuZauRiL4CcGv/1X/+FxYsXO+/ffffdRVwNIWS6+8pXvoL6+voht9PvFjKVUJBzmrjssstwySWXOO///Oc/R29vb/EWRAiZ1tauXYtzzz13yO30u4VMJXRcNcPpug4AEMXjf6vz29CHDh1ybrNtG8u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1/w8Y9/HLZt45ZbbilYz80334yGhgbcfvvtKCkpwfbt2/H3v/8dH/zgBwHw79tVV12F6upq3HbbbaiqqsLu3bvxyCOP4LbbbgMANDY24oILLsCsWbPwhS98AT6fD5s2bcK73vUu/PGPf3Rem3g8jrVr14Ixhs985jOora0FAHz6058e03Mfq29961vo6uoacvvvfvc7fPzjH8cll1yCT3ziE/D5fNi9eze+/vWvF9xv69ateOtb34o77rhjyEVpMtx///244YYbcPnll+Oee+5BJpPBvffei7e85S3Yvn075s6dO+7H/P3vf49MJoOPfexjiEQi2Lp1K37wgx/g8OHD+P3vfz/i55177rmYN28eNm3ahBtuuKHgY7/73e8QDodx+eWXAwD+4z/+A3/4wx9w6623YsmSJejr68Nzzz2H3bt3Y+XKleNe81h95zvfQVlZGYChR1tdXV1YvXo1MpkMPvnJTyISiWDjxo24+uqr8Yc//KHg3+WJGO/vLwCYPXs21q9fD4AH3h/72McmZS3kJGNkRvvud7/LALCdO3cW3H7xxRezhoaGgts2bNjAALDm5mbGGGO5XI7NmTOHrV27lgFgGzZscO6byWSGfK3f/OY3DAB79tlnndvuuOMOBoD19PSMuMaLL76YAWDf+ta3nNs0TWMrVqxgFRUVTNd1xhhjpmkyTdMKPjcajbLKykp28803O7c1NzczAOy6665jsiyzzs5O52Nr1qxhH/zgBxkA9o1vfGPIOq+77jp21VVXObe3tLQwURTZddddN+R5DPcafPSjH2Ver5flcrkRn+/Ar3f11VcX3P7xj398yPdruK9z+eWXs3nz5jnvx2IxFggE2Jve9CaWzWYL7mvbNmOMv3719fWsrq6ORaPRYe/DGH+Nli5dWvAcbNtmq1evZgsWLHBue+yxxxgA9pvf/Kbgserq6tiVV17pvJ//uXr55ZcL7tfT08MAsDvuuGPI65LX3d3NAoGA8zP41FNPOR+77rrrWElJScHzfeqppxgA9vvf/37IbQO/zkhuuOEG5vP5Rvw4AHbLLbc47yeTSVZSUsI+8pGPFNyvs7OThUKhgttHeuzf//73Q57bcN/z9evXM0EQWEtLy6jP4fb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VfB1zlw4AAAjFq6O5b77N+/H4wx/L//9/9QXl5e8JYPdru
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"import matplotlib.pyplot as plt\n",
|
|||
|
"\n",
|
|||
|
"# 1. Столбчатая диаграмма: средняя цена по количеству спален\n",
|
|||
|
"data_frame.groupby(\"bedrooms\")[\"price\"].mean().plot.bar(color=\"skyblue\")\n",
|
|||
|
"plt.title(\"Средняя цена по количеству спален\")\n",
|
|||
|
"plt.xlabel(\"Количество спален\")\n",
|
|||
|
"plt.ylabel(\"Средняя цена\")\n",
|
|||
|
"plt.show()\n",
|
|||
|
"\n",
|
|||
|
"# 2. Гистограмма: распределение цен\n",
|
|||
|
"data_frame[\"price\"].plot.hist(bins=30, color=\"orange\", alpha=0.7)\n",
|
|||
|
"plt.title(\"Гистограмма цен\")\n",
|
|||
|
"plt.xlabel(\"Цена\")\n",
|
|||
|
"plt.ylabel(\"Частота\")\n",
|
|||
|
"plt.show()\n",
|
|||
|
"\n",
|
|||
|
"# 3. Ящик с усами: цена по количеству ванных комнат\n",
|
|||
|
"data_frame.boxplot(column=\"price\", by=\"bathrooms\")\n",
|
|||
|
"plt.title(\"Ящик с усами цен по количеству ванных комнат\")\n",
|
|||
|
"plt.suptitle(\"\")\n",
|
|||
|
"plt.xlabel(\"Количество ванных комнат\")\n",
|
|||
|
"plt.ylabel(\"Цена\")\n",
|
|||
|
"plt.show()\n",
|
|||
|
"\n",
|
|||
|
"# 4. Диаграмма с областями: суммарная цена по количеству этажей\n",
|
|||
|
"data_frame.groupby(\"floors\")[\"price\"].sum().plot.area(color=\"lightgreen\", alpha=0.5)\n",
|
|||
|
"plt.title(\"Суммарная цена по количеству этажей\")\n",
|
|||
|
"plt.xlabel(\"Количество этажей\")\n",
|
|||
|
"plt.ylabel(\"Суммарная цена\")\n",
|
|||
|
"plt.show()\n",
|
|||
|
"\n",
|
|||
|
"# 5. Диаграмма рассеяния: цена vs. площадь\n",
|
|||
|
"data_frame.plot.scatter(x=\"sqft_living\", y=\"price\", color=\"purple\", alpha=0.5)\n",
|
|||
|
"plt.title(\"Диаграмма рассеяния: Цена vs Площадь\")\n",
|
|||
|
"plt.xlabel(\"Площадь (sqft)\")\n",
|
|||
|
"plt.ylabel(\"Цена\")\n",
|
|||
|
"plt.show()\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"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
|
|||
|
}
|