AIM-PIbd-32-Katysheva-N-E/lab_1/lab1.ipynb

109 lines
2.9 KiB
Plaintext
Raw Normal View History

2024-09-13 21:24:33 +04:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Начало лабораборной\n",
"\n",
"Выгрузка данных из csv файла в датафрейм"
]
},
{
"cell_type": "code",
2024-09-13 21:27:08 +04:00
"execution_count": 3,
2024-09-13 21:24:33 +04:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Index(['gender', 'race/ethnicity', 'parental level of education', 'lunch',\n",
" 'test preparation course', 'math score', 'reading score',\n",
" 'writing score'],\n",
" dtype='object')\n"
]
}
],
"source": [
"import pandas as pd\n",
"\n",
2024-09-13 21:27:08 +04:00
"df = pd.read_csv(\"..//..//static//csv//StudentsPerformance.csv\")\n",
2024-09-13 21:24:33 +04:00
"print (df.columns)"
]
2024-09-13 23:36:58 +04:00
},
{
"cell_type": "code",
"execution_count": 4,
"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": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" count mean std min 25% 50% 75% max\n",
"math score 1000.0 66.089 15.163080 0.0 57.00 66.0 77.0 100.0\n",
"reading score 1000.0 69.169 14.600192 17.0 59.00 70.0 79.0 100.0\n",
"writing score 1000.0 68.054 15.195657 10.0 57.75 69.0 79.0 100.0\n"
]
}
],
"source": [
"print(df.describe().transpose())"
]
2024-09-13 21:24:33 +04:00
}
],
"metadata": {
"kernelspec": {
"display_name": "aimenv",
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}