Spaces:
Sleeping
Sleeping
File size: 9,278 Bytes
5a2cb18 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"os.chdir(\"D:\\ml_project\")"
]
},
{
"cell_type": "code",
"execution_count": 8,
"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>gender</th>\n",
" <th>race_ethnicity</th>\n",
" <th>parental_level_of_education</th>\n",
" <th>lunch</th>\n",
" <th>test_preparation_course</th>\n",
" <th>math_score</th>\n",
" <th>reading_score</th>\n",
" <th>writing_score</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>female</td>\n",
" <td>group B</td>\n",
" <td>bachelor's degree</td>\n",
" <td>standard</td>\n",
" <td>none</td>\n",
" <td>72</td>\n",
" <td>72</td>\n",
" <td>74</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>female</td>\n",
" <td>group C</td>\n",
" <td>some college</td>\n",
" <td>standard</td>\n",
" <td>completed</td>\n",
" <td>69</td>\n",
" <td>90</td>\n",
" <td>88</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>female</td>\n",
" <td>group B</td>\n",
" <td>master's degree</td>\n",
" <td>standard</td>\n",
" <td>none</td>\n",
" <td>90</td>\n",
" <td>95</td>\n",
" <td>93</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>male</td>\n",
" <td>group A</td>\n",
" <td>associate's degree</td>\n",
" <td>free/reduced</td>\n",
" <td>none</td>\n",
" <td>47</td>\n",
" <td>57</td>\n",
" <td>44</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>male</td>\n",
" <td>group C</td>\n",
" <td>some college</td>\n",
" <td>standard</td>\n",
" <td>none</td>\n",
" <td>76</td>\n",
" <td>78</td>\n",
" <td>75</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" gender race_ethnicity parental_level_of_education lunch \\\n",
"0 female group B bachelor's degree standard \n",
"1 female group C some college standard \n",
"2 female group B master's degree standard \n",
"3 male group A associate's degree free/reduced \n",
"4 male group C some college standard \n",
"\n",
" test_preparation_course math_score reading_score writing_score \n",
"0 none 72 72 74 \n",
"1 completed 69 90 88 \n",
"2 none 90 95 93 \n",
"3 none 47 57 44 \n",
"4 none 76 78 75 "
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df = pd.read_csv(\"data.csv\")\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"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>math_score</th>\n",
" <th>reading_score</th>\n",
" <th>writing_score</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>1000.00000</td>\n",
" <td>1000.000000</td>\n",
" <td>1000.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>66.08900</td>\n",
" <td>69.169000</td>\n",
" <td>68.054000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>15.16308</td>\n",
" <td>14.600192</td>\n",
" <td>15.195657</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>0.00000</td>\n",
" <td>17.000000</td>\n",
" <td>10.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>57.00000</td>\n",
" <td>59.000000</td>\n",
" <td>57.750000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>66.00000</td>\n",
" <td>70.000000</td>\n",
" <td>69.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>77.00000</td>\n",
" <td>79.000000</td>\n",
" <td>79.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>100.00000</td>\n",
" <td>100.000000</td>\n",
" <td>100.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" math_score reading_score writing_score\n",
"count 1000.00000 1000.000000 1000.000000\n",
"mean 66.08900 69.169000 68.054000\n",
"std 15.16308 14.600192 15.195657\n",
"min 0.00000 17.000000 10.000000\n",
"25% 57.00000 59.000000 57.750000\n",
"50% 66.00000 70.000000 69.000000\n",
"75% 77.00000 79.000000 79.000000\n",
"max 100.00000 100.000000 100.000000"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.describe()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 1000 entries, 0 to 999\n",
"Data columns (total 8 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 gender 1000 non-null object\n",
" 1 race_ethnicity 1000 non-null object\n",
" 2 parental_level_of_education 1000 non-null object\n",
" 3 lunch 1000 non-null object\n",
" 4 test_preparation_course 1000 non-null object\n",
" 5 math_score 1000 non-null int64 \n",
" 6 reading_score 1000 non-null int64 \n",
" 7 writing_score 1000 non-null int64 \n",
"dtypes: int64(3), object(5)\n",
"memory usage: 62.6+ KB\n"
]
}
],
"source": [
"df.info()"
]
},
{
"cell_type": "code",
"execution_count": null,
"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"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
|