Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
244 changes: 210 additions & 34 deletions your-code/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# import libraries here"
"import pandas as pd"
]
},
{
Expand All @@ -37,11 +37,11 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"# your code here"
"temp = pd.read_csv('Temp_States.csv')"
]
},
{
Expand All @@ -53,11 +53,100 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# your code here"
"execution_count": 5,
"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>City</th>\n",
" <th>State</th>\n",
" <th>Temperature</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>NYC</td>\n",
" <td>New York</td>\n",
" <td>19.444444</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Albany</td>\n",
" <td>New York</td>\n",
" <td>9.444444</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Buffalo</td>\n",
" <td>New York</td>\n",
" <td>3.333333</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Hartford</td>\n",
" <td>Connecticut</td>\n",
" <td>17.222222</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Bridgeport</td>\n",
" <td>Connecticut</td>\n",
" <td>14.444444</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Treton</td>\n",
" <td>New Jersey</td>\n",
" <td>22.222222</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>Newark</td>\n",
" <td>New Jersey</td>\n",
" <td>20.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" City State Temperature\n",
"0 NYC New York 19.444444\n",
"1 Albany New York 9.444444\n",
"2 Buffalo New York 3.333333\n",
"3 Hartford Connecticut 17.222222\n",
"4 Bridgeport Connecticut 14.444444\n",
"5 Treton New Jersey 22.222222\n",
"6 Newark New Jersey 20.000000"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"temp"
]
},
{
Expand All @@ -69,11 +158,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"City object\n",
"State object\n",
"Temperature float64\n",
"dtype: object\n"
]
}
],
"source": [
"# your code here"
"print(temp.dtypes)"
]
},
{
Expand All @@ -82,9 +182,7 @@
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
"your comments here\n",
"\"\"\""
"#I dont really know what to comment. It makes sense"
]
},
{
Expand All @@ -96,11 +194,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" City State Temperature\n",
"0 NYC New York 19.444444\n",
"1 Albany New York 9.444444\n",
"2 Buffalo New York 3.333333\n"
]
}
],
"source": [
"# your code here"
"newyork = temp.loc[temp['State'] == 'New York']\n",
"\n",
"print(newyork)\n"
]
},
{
Expand All @@ -112,11 +223,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"10.74074074074074"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# your code here"
"newyork['Temperature'].mean()"
]
},
{
Expand All @@ -128,11 +250,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" City State Temperature\n",
"0 NYC New York 19.444444\n",
"3 Hartford Connecticut 17.222222\n",
"5 Treton New Jersey 22.222222\n",
"6 Newark New Jersey 20.000000\n"
]
}
],
"source": [
"# your code here"
"more15 = temp.loc[temp['Temperature'] > 15]\n",
"\n",
"print(more15)"
]
},
{
Expand All @@ -144,11 +280,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" City\n",
"0 NYC\n",
"3 Hartford\n",
"5 Treton\n",
"6 Newark\n"
]
}
],
"source": [
"# your code here"
"more15city = temp.loc[temp['Temperature'] > 15, ['City']]\n",
"\n",
"print(more15city)\n"
]
},
{
Expand All @@ -162,11 +312,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 16,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" City\n",
"0 NYC\n",
"3 Hartford\n"
]
}
],
"source": [
"# your code here"
"city1520 = temp.loc[(temp['Temperature'] > 15) & (temp['Temperature'] < 20), ['City']]\n",
"\n",
"print(city1520)"
]
},
{
Expand All @@ -178,11 +340,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 17,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" mean std\n",
"State \n",
"Connecticut 15.833333 1.964186\n",
"New Jersey 21.111111 1.571348\n",
"New York 10.740741 8.133404\n"
]
}
],
"source": [
"# your code here"
"states = temp.groupby('State')['Temperature'].agg(['mean', 'std'])\n",
"\n",
"print(states)\n"
]
},
{
Expand Down Expand Up @@ -799,7 +975,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down