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
304 changes: 294 additions & 10 deletions your-code/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": []
"source": [
"import pandas as pd"
]
},
{
"cell_type": "markdown",
Expand All @@ -25,10 +27,33 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": []
"source": [
"users = pd.read_csv(\"../data/users.csv\", index_col=0)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"40325"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"users.head(10)\n",
"len(users)"
]
},
{
"cell_type": "markdown",
Expand All @@ -53,10 +78,33 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": []
"source": [
"posts = pd.read_csv(\"../data/posts.csv\", index_col=0)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"91976"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"posts.head()\n",
"len(posts)"
]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -98,10 +146,217 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": []
"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>userId</th>\n",
" <th>Reputation</th>\n",
" <th>Views</th>\n",
" <th>UpVotes</th>\n",
" <th>DownVotes</th>\n",
" <th>PostId</th>\n",
" <th>Score</th>\n",
" <th>ViewCount</th>\n",
" <th>CommentCount</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>-1.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>5007.0</td>\n",
" <td>1920.0</td>\n",
" <td>2175.0</td>\n",
" <td>0.0</td>\n",
" <td>NaN</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>-1.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>5007.0</td>\n",
" <td>1920.0</td>\n",
" <td>8576.0</td>\n",
" <td>0.0</td>\n",
" <td>NaN</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>-1.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>5007.0</td>\n",
" <td>1920.0</td>\n",
" <td>8578.0</td>\n",
" <td>0.0</td>\n",
" <td>NaN</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>-1.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>5007.0</td>\n",
" <td>1920.0</td>\n",
" <td>8981.0</td>\n",
" <td>0.0</td>\n",
" <td>NaN</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>-1.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>5007.0</td>\n",
" <td>1920.0</td>\n",
" <td>8982.0</td>\n",
" <td>0.0</td>\n",
" <td>NaN</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>110313</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>114678.0</td>\n",
" <td>0.0</td>\n",
" <td>20.0</td>\n",
" <td>2.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>110314</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>114812.0</td>\n",
" <td>0.0</td>\n",
" <td>16.0</td>\n",
" <td>1.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>110315</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>114815.0</td>\n",
" <td>1.0</td>\n",
" <td>14.0</td>\n",
" <td>5.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>110316</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>115225.0</td>\n",
" <td>0.0</td>\n",
" <td>8.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>110317</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>115271.0</td>\n",
" <td>0.0</td>\n",
" <td>9.0</td>\n",
" <td>2.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>110318 rows × 9 columns</p>\n",
"</div>"
],
"text/plain": [
" userId Reputation Views UpVotes DownVotes PostId Score \\\n",
"0 -1.0 1.0 0.0 5007.0 1920.0 2175.0 0.0 \n",
"1 -1.0 1.0 0.0 5007.0 1920.0 8576.0 0.0 \n",
"2 -1.0 1.0 0.0 5007.0 1920.0 8578.0 0.0 \n",
"3 -1.0 1.0 0.0 5007.0 1920.0 8981.0 0.0 \n",
"4 -1.0 1.0 0.0 5007.0 1920.0 8982.0 0.0 \n",
"... ... ... ... ... ... ... ... \n",
"110313 NaN NaN NaN NaN NaN 114678.0 0.0 \n",
"110314 NaN NaN NaN NaN NaN 114812.0 0.0 \n",
"110315 NaN NaN NaN NaN NaN 114815.0 1.0 \n",
"110316 NaN NaN NaN NaN NaN 115225.0 0.0 \n",
"110317 NaN NaN NaN NaN NaN 115271.0 0.0 \n",
"\n",
" ViewCount CommentCount \n",
"0 NaN 0.0 \n",
"1 NaN 0.0 \n",
"2 NaN 0.0 \n",
"3 NaN 0.0 \n",
"4 NaN 0.0 \n",
"... ... ... \n",
"110313 20.0 2.0 \n",
"110314 16.0 1.0 \n",
"110315 14.0 5.0 \n",
"110316 8.0 0.0 \n",
"110317 9.0 2.0 \n",
"\n",
"[110318 rows x 9 columns]"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"users.merge(right=posts, how=\"outer\", on=\"userId\")"
]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -163,7 +418,36 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.9.0"
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
Expand Down