File name
Commit message
Commit date
File name
Commit message
Commit date
{
"cells": [
{
"cell_type": "code",
"execution_count": 87,
"id": "7751f08f",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 88,
"id": "55538996",
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv('./sample2.csv', encoding='euc-kr')"
]
},
{
"cell_type": "code",
"execution_count": 89,
"id": "d0b82694",
"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>이름</th>\n",
" <th>나이</th>\n",
" <th>성별</th>\n",
" <th>키</th>\n",
" <th>체중</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>홍길동</td>\n",
" <td>25</td>\n",
" <td>남</td>\n",
" <td>185</td>\n",
" <td>89</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>이순신</td>\n",
" <td>19</td>\n",
" <td>여</td>\n",
" <td>163</td>\n",
" <td>53</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 이름 나이 성별 키 체중\n",
"0 홍길동 25 남 185 89\n",
"1 이순신 19 여 163 53"
]
},
"execution_count": 89,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df"
]
},
{
"cell_type": "code",
"execution_count": 90,
"id": "38ee5685",
"metadata": {},
"outputs": [],
"source": [
"df = df.set_index('이름')"
]
},
{
"cell_type": "code",
"execution_count": 91,
"id": "33fa0239",
"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>나이</th>\n",
" <th>성별</th>\n",
" <th>키</th>\n",
" <th>체중</th>\n",
" </tr>\n",
" <tr>\n",
" <th>이름</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>홍길동</th>\n",
" <td>25</td>\n",
" <td>남</td>\n",
" <td>185</td>\n",
" <td>89</td>\n",
" </tr>\n",
" <tr>\n",
" <th>이순신</th>\n",
" <td>19</td>\n",
" <td>여</td>\n",
" <td>163</td>\n",
" <td>53</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 나이 성별 키 체중\n",
"이름 \n",
"홍길동 25 남 185 89\n",
"이순신 19 여 163 53"
]
},
"execution_count": 91,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df"
]
},
{
"cell_type": "code",
"execution_count": 92,
"id": "749d1c65",
"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>나이</th>\n",
" <th>성별</th>\n",
" <th>키</th>\n",
" <th>체중</th>\n",
" </tr>\n",
" <tr>\n",
" <th>이름</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>홍길동</th>\n",
" <td>25</td>\n",
" <td>남</td>\n",
" <td>185</td>\n",
" <td>89</td>\n",
" </tr>\n",
" <tr>\n",
" <th>이순신</th>\n",
" <td>19</td>\n",
" <td>여</td>\n",
" <td>163</td>\n",
" <td>53</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 나이 성별 키 체중\n",
"이름 \n",
"홍길동 25 남 185 89\n",
"이순신 19 여 163 53"
]
},
"execution_count": 92,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.loc[['홍길동', '이순신']]"
]
},
{
"cell_type": "code",
"execution_count": 93,
"id": "2bba1d93",
"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>나이</th>\n",
" </tr>\n",
" <tr>\n",
" <th>이름</th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>홍길동</th>\n",
" <td>25</td>\n",
" </tr>\n",
" <tr>\n",
" <th>이순신</th>\n",
" <td>19</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 나이\n",
"이름 \n",
"홍길동 25\n",
"이순신 19"
]
},
"execution_count": 93,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df[['나이']]"
]
},
{
"cell_type": "code",
"execution_count": 94,
"id": "5139c5f4",
"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>성별</th>\n",
" <th>키</th>\n",
" <th>체중</th>\n",
" </tr>\n",
" <tr>\n",
" <th>이름</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>홍길동</th>\n",
" <td>남</td>\n",
" <td>185</td>\n",
" <td>89</td>\n",
" </tr>\n",
" <tr>\n",
" <th>이순신</th>\n",
" <td>여</td>\n",
" <td>163</td>\n",
" <td>53</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 성별 키 체중\n",
"이름 \n",
"홍길동 남 185 89\n",
"이순신 여 163 53"
]
},
"execution_count": 94,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df[['성별', '키', '체중']]"
]
},
{
"cell_type": "code",
"execution_count": 95,
"id": "4cc78d1f",
"metadata": {},
"outputs": [],
"source": [
"df['DMI'] = 0"
]
},
{
"cell_type": "code",
"execution_count": 96,
"id": "a0368a19",
"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>나이</th>\n",
" <th>성별</th>\n",
" <th>키</th>\n",
" <th>체중</th>\n",
" <th>DMI</th>\n",
" </tr>\n",
" <tr>\n",
" <th>이름</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>홍길동</th>\n",
" <td>25</td>\n",
" <td>남</td>\n",
" <td>185</td>\n",
" <td>89</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>이순신</th>\n",
" <td>19</td>\n",
" <td>여</td>\n",
" <td>163</td>\n",
" <td>53</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 나이 성별 키 체중 DMI\n",
"이름 \n",
"홍길동 25 남 185 89 0\n",
"이순신 19 여 163 53 0"
]
},
"execution_count": 96,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df"
]
},
{
"cell_type": "code",
"execution_count": 97,
"id": "21f1488e",
"metadata": {},
"outputs": [],
"source": [
"df.loc['유관순'] = 0"
]
},
{
"cell_type": "code",
"execution_count": 98,
"id": "db577036",
"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>나이</th>\n",
" <th>성별</th>\n",
" <th>키</th>\n",
" <th>체중</th>\n",
" <th>DMI</th>\n",
" </tr>\n",
" <tr>\n",
" <th>이름</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>홍길동</th>\n",
" <td>25</td>\n",
" <td>남</td>\n",
" <td>185</td>\n",
" <td>89</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>이순신</th>\n",
" <td>19</td>\n",
" <td>여</td>\n",
" <td>163</td>\n",
" <td>53</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>유관순</th>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 나이 성별 키 체중 DMI\n",
"이름 \n",
"홍길동 25 남 185 89 0\n",
"이순신 19 여 163 53 0\n",
"유관순 0 0 0 0 0"
]
},
"execution_count": 98,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df"
]
},
{
"cell_type": "code",
"execution_count": 99,
"id": "009ea0c5",
"metadata": {},
"outputs": [],
"source": [
"df.iloc[2] = [24, '여', 166, 23, 0]"
]
},
{
"cell_type": "code",
"execution_count": 100,
"id": "f24bf138",
"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>나이</th>\n",
" <th>성별</th>\n",
" <th>키</th>\n",
" <th>체중</th>\n",
" <th>DMI</th>\n",
" </tr>\n",
" <tr>\n",
" <th>이름</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>홍길동</th>\n",
" <td>25</td>\n",
" <td>남</td>\n",
" <td>185</td>\n",
" <td>89</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>이순신</th>\n",
" <td>19</td>\n",
" <td>여</td>\n",
" <td>163</td>\n",
" <td>53</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>유관순</th>\n",
" <td>24</td>\n",
" <td>여</td>\n",
" <td>166</td>\n",
" <td>23</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 나이 성별 키 체중 DMI\n",
"이름 \n",
"홍길동 25 남 185 89 0\n",
"이순신 19 여 163 53 0\n",
"유관순 24 여 166 23 0"
]
},
"execution_count": 100,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df"
]
},
{
"cell_type": "code",
"execution_count": 101,
"id": "8aa2aada",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"나이 19\n",
"성별 여\n",
"키 163\n",
"체중 53\n",
"DMI 0\n",
"Name: 이순신, dtype: object"
]
},
"execution_count": 101,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.loc['이순신']"
]
},
{
"cell_type": "code",
"execution_count": 102,
"id": "e392a242",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"163"
]
},
"execution_count": 102,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.loc['이순신', '키']"
]
},
{
"cell_type": "code",
"execution_count": 103,
"id": "3bcdf7ff",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"체중 53\n",
"키 163\n",
"Name: 이순신, dtype: object"
]
},
"execution_count": 103,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.loc['이순신', ['체중', '키']]"
]
},
{
"cell_type": "code",
"execution_count": 104,
"id": "a4bd7696",
"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>홍길동</th>\n",
" <th>이순신</th>\n",
" <th>유관순</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>나이</th>\n",
" <td>25</td>\n",
" <td>19</td>\n",
" <td>24</td>\n",
" </tr>\n",
" <tr>\n",
" <th>성별</th>\n",
" <td>남</td>\n",
" <td>여</td>\n",
" <td>여</td>\n",
" </tr>\n",
" <tr>\n",
" <th>키</th>\n",
" <td>185</td>\n",
" <td>163</td>\n",
" <td>166</td>\n",
" </tr>\n",
" <tr>\n",
" <th>체중</th>\n",
" <td>89</td>\n",
" <td>53</td>\n",
" <td>23</td>\n",
" </tr>\n",
" <tr>\n",
" <th>DMI</th>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
"이름 홍길동 이순신 유관순\n",
"나이 25 19 24\n",
"성별 남 여 여\n",
"키 185 163 166\n",
"체중 89 53 23\n",
"DMI 0 0 0"
]
},
"execution_count": 104,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.transpose()"
]
},
{
"cell_type": "code",
"execution_count": 105,
"id": "1761096c",
"metadata": {},
"outputs": [],
"source": [
"df2 = df"
]
},
{
"cell_type": "code",
"execution_count": 106,
"id": "83f4eab2",
"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>나이</th>\n",
" <th>성별</th>\n",
" <th>키</th>\n",
" <th>체중</th>\n",
" <th>DMI</th>\n",
" </tr>\n",
" <tr>\n",
" <th>이름</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>홍길동</th>\n",
" <td>25</td>\n",
" <td>남</td>\n",
" <td>185</td>\n",
" <td>89</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>이순신</th>\n",
" <td>19</td>\n",
" <td>여</td>\n",
" <td>163</td>\n",
" <td>53</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>유관순</th>\n",
" <td>24</td>\n",
" <td>여</td>\n",
" <td>166</td>\n",
" <td>23</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 나이 성별 키 체중 DMI\n",
"이름 \n",
"홍길동 25 남 185 89 0\n",
"이순신 19 여 163 53 0\n",
"유관순 24 여 166 23 0"
]
},
"execution_count": 106,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2"
]
},
{
"cell_type": "code",
"execution_count": 107,
"id": "eb5006a7",
"metadata": {},
"outputs": [],
"source": [
"df3 = df.copy()"
]
},
{
"cell_type": "code",
"execution_count": 108,
"id": "78c400ba",
"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>나이</th>\n",
" <th>성별</th>\n",
" <th>키</th>\n",
" <th>체중</th>\n",
" <th>DMI</th>\n",
" </tr>\n",
" <tr>\n",
" <th>이름</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>홍길동</th>\n",
" <td>25</td>\n",
" <td>남</td>\n",
" <td>185</td>\n",
" <td>89</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>이순신</th>\n",
" <td>19</td>\n",
" <td>여</td>\n",
" <td>163</td>\n",
" <td>53</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>유관순</th>\n",
" <td>24</td>\n",
" <td>여</td>\n",
" <td>166</td>\n",
" <td>23</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 나이 성별 키 체중 DMI\n",
"이름 \n",
"홍길동 25 남 185 89 0\n",
"이순신 19 여 163 53 0\n",
"유관순 24 여 166 23 0"
]
},
"execution_count": 108,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df3"
]
},
{
"cell_type": "code",
"execution_count": 109,
"id": "f02ab960",
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"df.drop('유관순', inplace=True)"
]
},
{
"cell_type": "code",
"execution_count": 110,
"id": "3aa56f51",
"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>나이</th>\n",
" <th>성별</th>\n",
" <th>키</th>\n",
" <th>체중</th>\n",
" <th>DMI</th>\n",
" </tr>\n",
" <tr>\n",
" <th>이름</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>홍길동</th>\n",
" <td>25</td>\n",
" <td>남</td>\n",
" <td>185</td>\n",
" <td>89</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>이순신</th>\n",
" <td>19</td>\n",
" <td>여</td>\n",
" <td>163</td>\n",
" <td>53</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 나이 성별 키 체중 DMI\n",
"이름 \n",
"홍길동 25 남 185 89 0\n",
"이순신 19 여 163 53 0"
]
},
"execution_count": 110,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df"
]
},
{
"cell_type": "code",
"execution_count": 111,
"id": "46c07ca4",
"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>나이</th>\n",
" <th>성별</th>\n",
" <th>키</th>\n",
" <th>체중</th>\n",
" <th>DMI</th>\n",
" </tr>\n",
" <tr>\n",
" <th>이름</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>홍길동</th>\n",
" <td>25</td>\n",
" <td>남</td>\n",
" <td>185</td>\n",
" <td>89</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>이순신</th>\n",
" <td>19</td>\n",
" <td>여</td>\n",
" <td>163</td>\n",
" <td>53</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 나이 성별 키 체중 DMI\n",
"이름 \n",
"홍길동 25 남 185 89 0\n",
"이순신 19 여 163 53 0"
]
},
"execution_count": 111,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2"
]
},
{
"cell_type": "code",
"execution_count": 112,
"id": "0acaa561",
"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>나이</th>\n",
" <th>성별</th>\n",
" <th>키</th>\n",
" <th>체중</th>\n",
" <th>DMI</th>\n",
" </tr>\n",
" <tr>\n",
" <th>이름</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>홍길동</th>\n",
" <td>25</td>\n",
" <td>남</td>\n",
" <td>185</td>\n",
" <td>89</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>이순신</th>\n",
" <td>19</td>\n",
" <td>여</td>\n",
" <td>163</td>\n",
" <td>53</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>유관순</th>\n",
" <td>24</td>\n",
" <td>여</td>\n",
" <td>166</td>\n",
" <td>23</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 나이 성별 키 체중 DMI\n",
"이름 \n",
"홍길동 25 남 185 89 0\n",
"이순신 19 여 163 53 0\n",
"유관순 24 여 166 23 0"
]
},
"execution_count": 112,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df3"
]
},
{
"cell_type": "code",
"execution_count": 114,
"id": "74386020",
"metadata": {},
"outputs": [],
"source": [
"df3.drop('DMI', axis=1, inplace=True)"
]
},
{
"cell_type": "code",
"execution_count": 115,
"id": "10fba552",
"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>나이</th>\n",
" <th>성별</th>\n",
" <th>키</th>\n",
" <th>체중</th>\n",
" </tr>\n",
" <tr>\n",
" <th>이름</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>홍길동</th>\n",
" <td>25</td>\n",
" <td>남</td>\n",
" <td>185</td>\n",
" <td>89</td>\n",
" </tr>\n",
" <tr>\n",
" <th>이순신</th>\n",
" <td>19</td>\n",
" <td>여</td>\n",
" <td>163</td>\n",
" <td>53</td>\n",
" </tr>\n",
" <tr>\n",
" <th>유관순</th>\n",
" <td>24</td>\n",
" <td>여</td>\n",
" <td>166</td>\n",
" <td>23</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 나이 성별 키 체중\n",
"이름 \n",
"홍길동 25 남 185 89\n",
"이순신 19 여 163 53\n",
"유관순 24 여 166 23"
]
},
"execution_count": 115,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df3"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1d4feb02",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "be501238",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "442028fe",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "8db0ece8",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "8df4eea1",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "7119cc11",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "640b7a81",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "a8633397",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}