Skip to content

Commit

Permalink
updated 02_function_basics/Class_II_Python.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
NovaVolunteer committed Aug 29, 2023
1 parent ba25fd3 commit 5a8e038
Showing 1 changed file with 21 additions and 40 deletions.
61 changes: 21 additions & 40 deletions 02_function_basics/Class_II_Python.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"id": "317858ce",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'c:\\\\Users\\\\Brian Wright\\\\Documents\\\\3001Python\\\\DS-3001\\\\02_R_function_basics'"
"'c:\\\\Users\\\\Brian Wright\\\\Documents\\\\3001Python\\\\DS-3001\\\\02_function_basics'"
]
},
"execution_count": 3,
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -120,25 +120,6 @@
" - Arrange in descending order by Mean GPA"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "4fa93edc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'c:\\\\Users\\\\Brian Wright\\\\Documents\\\\3001Python\\\\DS-3001\\\\02_R_function_basics'"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": 4,
Expand Down Expand Up @@ -181,7 +162,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 9,
"id": "66c004cb",
"metadata": {},
"outputs": [
Expand All @@ -192,21 +173,21 @@
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 400 entries, 0 to 399\n",
"Data columns (total 4 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 admit 400 non-null int64 \n",
" 1 gre 400 non-null int64 \n",
" 2 gpa 400 non-null float64\n",
" 3 rank 400 non-null int64 \n",
"dtypes: float64(1), int64(3)\n",
"memory usage: 12.6 KB\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 admit 400 non-null int64 \n",
" 1 gre 400 non-null int64 \n",
" 2 gpa 400 non-null float64 \n",
" 3 rank 400 non-null category\n",
"dtypes: category(1), float64(1), int64(2)\n",
"memory usage: 10.1 KB\n",
"None\n"
]
}
],
"source": [
"admit_2.rank = admit_2.rank.astype(\"category\") # here, we assign the newly-assigned vars\n",
"# to the corresponding columns in the initial dataframe. \n",
" #change rank to a categorical variable\n",
"admit_2['rank'] = admit_2['rank'].astype(\"category\") # here, we assign the newly-assigned vars\n",
"\n",
"print(admit_2.info())"
]
Expand Down Expand Up @@ -293,12 +274,12 @@
"</div>"
],
"text/plain": [
" admit gre gpa rank\n",
"0 0 380 3.61 3\n",
"1 1 660 3.67 3\n",
"2 1 800 4.00 1\n",
"3 1 640 3.19 4\n",
"4 0 520 2.93 4"
" admit gre gpa rank\n",
"0 0 380 3.61 3\n",
"1 1 660 3.67 3\n",
"2 1 800 4.00 1\n",
"3 1 640 3.19 4\n",
"4 0 520 2.93 4"
]
},
"execution_count": 6,
Expand Down Expand Up @@ -956,7 +937,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.17"
},
"vscode": {
"interpreter": {
Expand Down

0 comments on commit 5a8e038

Please sign in to comment.