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
142 changes: 130 additions & 12 deletions your-code/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
"outputs": [],
"source": [
"\"\"\"\n",
"your solution here\n",
"Statement 1 --> False\n",
"Statement 2 --> True\n",
"Statement 3 --> False\n",
"Statement 4 --> False\n",
"Statement 5 --> True\n",
"\n",
"\"\"\""
]
},
Expand All @@ -49,7 +54,10 @@
"outputs": [],
"source": [
"\"\"\"\n",
"your solution here\n",
"#1 = 0.333\n",
"#2 = 0.344\n",
"#3 = 0.39\n",
"#4 = 0.4\n",
"\"\"\""
]
},
Expand All @@ -75,7 +83,11 @@
"outputs": [],
"source": [
"\"\"\"\n",
"your solution here\n",
"P C|R 0.5\n",
"P C = 0.4\n",
"P R = 0.1\n",
"\n",
"P R|C = 0.125\n",
"\"\"\""
]
},
Expand All @@ -102,28 +114,134 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"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>Value</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Answer</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Yes</th>\n",
" <td>Men</td>\n",
" <td>324</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Yes</th>\n",
" <td>Women</td>\n",
" <td>351</td>\n",
" </tr>\n",
" <tr>\n",
" <th>No</th>\n",
" <td>Men</td>\n",
" <td>156</td>\n",
" </tr>\n",
" <tr>\n",
" <th>No</th>\n",
" <td>Woman</td>\n",
" <td>169</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Gender Value\n",
"Answer \n",
"Yes Men 324\n",
"Yes Women 351\n",
"No Men 156\n",
"No Woman 169"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# your code here"
"import pandas as pd\n",
"\n",
"df = pd.DataFrame({\"Gender\":[\"Men\", \"Women\", \"Men\", \"Woman\"], \"Answer\":[\"Yes\",\"Yes\",\"No\", \"No\"], \"Value\":[324, 351, 156, 169]}).set_index(\"Answer\")\n",
"df"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 30,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.675\n",
"0.324\n"
]
}
],
"source": [
"\"\"\"\n",
"your solution here\n",
"yes = (df.iloc[0][1]+df.iloc[1][1])\n",
"p1 = yes / sum(df[\"Value\"])\n",
"men_if_yes = df.iloc[0][1]/yes\n",
"p2 = p1 * men_if_yes\n",
"print(p1)\n",
"print(p2)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"' \\nThe fact of one wanting more light does not depend on whter one is male or female.\\n'"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"\"\" \n",
"The fact of one wanting more light does not depend on whter one is male or female.\n",
"\"\"\""
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -137,7 +255,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.11.3"
}
},
"nbformat": 4,
Expand Down