Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
heukirne committed Nov 6, 2017
1 parent fbfcba8 commit 85c0984
Show file tree
Hide file tree
Showing 16 changed files with 5,231 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.ipynb_checkpoints
/__pycache__
240 changes: 240 additions & 0 deletions 1_dataset_stats.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"Index(['medication', 'frequency', 'dose', 'target'], dtype='object')"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"\n",
"prescription = pd.read_csv('data/prescriptions_sample.csv.gz', compression='gzip')\n",
"prescription.columns"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"150113"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(prescription)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr>\n",
" <th></th>\n",
" <th>target</th>\n",
" </tr>\n",
" <tr>\n",
" <th></th>\n",
" <th>count</th>\n",
" </tr>\n",
" <tr>\n",
" <th>medication</th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>ALOPURINOL</th>\n",
" <td>4729</td>\n",
" </tr>\n",
" <tr>\n",
" <th>AMPICILINA</th>\n",
" <td>7226</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ANLODIPINO</th>\n",
" <td>10392</td>\n",
" </tr>\n",
" <tr>\n",
" <th>BISACODIL</th>\n",
" <td>9483</td>\n",
" </tr>\n",
" <tr>\n",
" <th>CETOPROFENO</th>\n",
" <td>10907</td>\n",
" </tr>\n",
" <tr>\n",
" <th>CLORETO</th>\n",
" <td>5593</td>\n",
" </tr>\n",
" <tr>\n",
" <th>DIAZEPAM</th>\n",
" <td>9030</td>\n",
" </tr>\n",
" <tr>\n",
" <th>DICLOFENACO</th>\n",
" <td>5559</td>\n",
" </tr>\n",
" <tr>\n",
" <th>DOXAZOSINA</th>\n",
" <td>6280</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ENALAPRIL</th>\n",
" <td>9585</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ENOXAPARINA</th>\n",
" <td>7666</td>\n",
" </tr>\n",
" <tr>\n",
" <th>HIDRALAZINA</th>\n",
" <td>6056</td>\n",
" </tr>\n",
" <tr>\n",
" <th>LOPERAMIDA</th>\n",
" <td>4957</td>\n",
" </tr>\n",
" <tr>\n",
" <th>MORFINA</th>\n",
" <td>5362</td>\n",
" </tr>\n",
" <tr>\n",
" <th>PARACETAMOL</th>\n",
" <td>10811</td>\n",
" </tr>\n",
" <tr>\n",
" <th>POLIMIXINA</th>\n",
" <td>7257</td>\n",
" </tr>\n",
" <tr>\n",
" <th>RISPERIDONA</th>\n",
" <td>5431</td>\n",
" </tr>\n",
" <tr>\n",
" <th>SULFAMETOXAZOL</th>\n",
" <td>7086</td>\n",
" </tr>\n",
" <tr>\n",
" <th>TENOFOVIR</th>\n",
" <td>4518</td>\n",
" </tr>\n",
" <tr>\n",
" <th>VARFARINA</th>\n",
" <td>6419</td>\n",
" </tr>\n",
" <tr>\n",
" <th>VITAMINAS</th>\n",
" <td>5766</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" target\n",
" count\n",
"medication \n",
"ALOPURINOL 4729\n",
"AMPICILINA 7226\n",
"ANLODIPINO 10392\n",
"BISACODIL 9483\n",
"CETOPROFENO 10907\n",
"CLORETO 5593\n",
"DIAZEPAM 9030\n",
"DICLOFENACO 5559\n",
"DOXAZOSINA 6280\n",
"ENALAPRIL 9585\n",
"ENOXAPARINA 7666\n",
"HIDRALAZINA 6056\n",
"LOPERAMIDA 4957\n",
"MORFINA 5362\n",
"PARACETAMOL 10811\n",
"POLIMIXINA 7257\n",
"RISPERIDONA 5431\n",
"SULFAMETOXAZOL 7086\n",
"TENOFOVIR 4518\n",
"VARFARINA 6419\n",
"VITAMINAS 5766"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"prescription[['medication','target']].groupby(['medication']).agg(['count'])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 85c0984

Please sign in to comment.