|
33 | 33 | "id": "5287cd41-7680-4ffc-be4e-cbf1098b7a86",
|
34 | 34 | "metadata": {
|
35 | 35 | "execution": {
|
36 |
| - "iopub.execute_input": "2022-04-01T22:30:15.776608Z", |
37 |
| - "iopub.status.busy": "2022-04-01T22:30:15.776608Z" |
| 36 | + "iopub.execute_input": "2022-04-01T22:54:59.484432Z", |
| 37 | + "iopub.status.busy": "2022-04-01T22:54:59.483441Z" |
38 | 38 | },
|
39 | 39 | "tags": []
|
40 | 40 | },
|
|
46 | 46 | "processing mimic-iv-1.0\\admissions.csv\n",
|
47 | 47 | "processing mimic-iv-1.0\\chartevents.csv\n"
|
48 | 48 | ]
|
| 49 | + }, |
| 50 | + { |
| 51 | + "name": "stderr", |
| 52 | + "output_type": "stream", |
| 53 | + "text": [ |
| 54 | + "C:\\Users\\jeev\\Anaconda3\\lib\\site-packages\\IPython\\core\\interactiveshell.py:3357: DtypeWarning: Columns (6,8) have mixed types.Specify dtype option on import or set low_memory=False.\n", |
| 55 | + " if (await self.run_code(code, result, async_=asy)):\n" |
| 56 | + ] |
49 | 57 | }
|
50 | 58 | ],
|
51 | 59 | "source": [
|
|
96 | 104 | " if os.path.exists(file_path):\n",
|
97 | 105 | " os.remove(file_path)\n",
|
98 | 106 | "\n",
|
99 |
| - "def create_db(input_dir, output_db, flush_size=1_000):\n", |
| 107 | + "def create_db(input_dir, output_db, flush_size=1_000_000):\n", |
100 | 108 | " delete_file_if_exists(output_db)\n",
|
101 | 109 | " pathlib.Path(output_db).touch()\n",
|
102 | 110 | " \n",
|
|
123 | 131 | " lines.append(line)\n",
|
124 | 132 | " \n",
|
125 | 133 | " if len(lines) == flush_size:\n",
|
126 |
| - " df = pd.read_csv(StringIO(''.join(lines)))\n", |
127 |
| - " df.to_sql(file_path.stem, conn, if_exists='append', index=False)\n", |
| 134 | + " pd.read_csv(StringIO(''.join(lines)), low_memory=False) \\\n", |
| 135 | + " .to_sql(file_path.stem, conn, if_exists='append', index=False)\n", |
128 | 136 | " \n",
|
129 | 137 | " lines = []\n",
|
130 | 138 | " lines.append(headers)\n",
|
131 | 139 | " \n",
|
132 |
| - " df = pd.read_csv(StringIO(''.join(lines)))\n", |
133 |
| - " df.to_sql(file_path.stem, conn, if_exists='append', index=False)\n", |
| 140 | + " pd.read_csv(StringIO(''.join(lines)), low_memory=False) \\\n", |
| 141 | + " to_sql(file_path.stem, conn, if_exists='append', index=False)\n", |
134 | 142 | " \n",
|
135 | 143 | " \n",
|
136 | 144 | "create_db('./mimic-iv-1.0', 'mimic.db')\n",
|
|
0 commit comments