Skip to content

Commit

Permalink
vis_buses folder is moved outside of sorted_data
Browse files Browse the repository at this point in the history
  • Loading branch information
Clgould99 committed Apr 12, 2024
1 parent 0d2c3ef commit 3bc9afd
Show file tree
Hide file tree
Showing 274 changed files with 258,432 additions and 185 deletions.
256 changes: 108 additions & 148 deletions py_packages/Example_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,107 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import auto_sort_data"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true,
"jupyter": {
"outputs_hidden": true
}
},
"outputs": [
{
"ename": "FileNotFoundError",
"evalue": "[Errno 2] No such file or directory: 'py_packages/sorted_data/vis_buses/bus_0a12131006540233500610'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
"File \u001b[0;32m~/miniconda3/lib/python3.11/shutil.py:825\u001b[0m, in \u001b[0;36mmove\u001b[0;34m(src, dst, copy_function)\u001b[0m\n\u001b[1;32m 824\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 825\u001b[0m os\u001b[38;5;241m.\u001b[39mrename(src, real_dst)\n\u001b[1;32m 826\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m:\n",
"\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'py_packages/sorted_data/vis_buses/bus_0a12131006540233500610' -> 'py_packages/vis_buses/bus_0a12131006540233500610'",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[3], line 6\u001b[0m\n\u001b[1;32m 3\u001b[0m current_path \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpy_packages/sorted_data/vis_buses/bus_0a12131006540233500610\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 4\u001b[0m destination_path \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpy_packages/vis_buses/bus_0a12131006540233500610\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m----> 6\u001b[0m shutil\u001b[38;5;241m.\u001b[39mmove(current_path, destination_path)\n",
"File \u001b[0;32m~/miniconda3/lib/python3.11/shutil.py:845\u001b[0m, in \u001b[0;36mmove\u001b[0;34m(src, dst, copy_function)\u001b[0m\n\u001b[1;32m 843\u001b[0m rmtree(src)\n\u001b[1;32m 844\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 845\u001b[0m copy_function(src, real_dst)\n\u001b[1;32m 846\u001b[0m os\u001b[38;5;241m.\u001b[39munlink(src)\n\u001b[1;32m 847\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m real_dst\n",
"File \u001b[0;32m~/miniconda3/lib/python3.11/shutil.py:436\u001b[0m, in \u001b[0;36mcopy2\u001b[0;34m(src, dst, follow_symlinks)\u001b[0m\n\u001b[1;32m 434\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39misdir(dst):\n\u001b[1;32m 435\u001b[0m dst \u001b[38;5;241m=\u001b[39m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mjoin(dst, os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mbasename(src))\n\u001b[0;32m--> 436\u001b[0m copyfile(src, dst, follow_symlinks\u001b[38;5;241m=\u001b[39mfollow_symlinks)\n\u001b[1;32m 437\u001b[0m copystat(src, dst, follow_symlinks\u001b[38;5;241m=\u001b[39mfollow_symlinks)\n\u001b[1;32m 438\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m dst\n",
"File \u001b[0;32m~/miniconda3/lib/python3.11/shutil.py:256\u001b[0m, in \u001b[0;36mcopyfile\u001b[0;34m(src, dst, follow_symlinks)\u001b[0m\n\u001b[1;32m 254\u001b[0m os\u001b[38;5;241m.\u001b[39msymlink(os\u001b[38;5;241m.\u001b[39mreadlink(src), dst)\n\u001b[1;32m 255\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 256\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mopen\u001b[39m(src, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mrb\u001b[39m\u001b[38;5;124m'\u001b[39m) \u001b[38;5;28;01mas\u001b[39;00m fsrc:\n\u001b[1;32m 257\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 258\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mopen\u001b[39m(dst, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mwb\u001b[39m\u001b[38;5;124m'\u001b[39m) \u001b[38;5;28;01mas\u001b[39;00m fdst:\n\u001b[1;32m 259\u001b[0m \u001b[38;5;66;03m# macOS\u001b[39;00m\n",
"\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'py_packages/sorted_data/vis_buses/bus_0a12131006540233500610'"
]
}
],
"source": [
"import shutil\n",
"\n",
"current_path = \"py_packages/sorted_data/vis_buses/bus_0a12131006540233500610\"\n",
"destination_path = \"py_packages/vis_buses/bus_0a12131006540233500610\"\n",
"\n",
"shutil.move(current_path, destination_path)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The path exists.\n"
]
}
],
"source": [
"import os\n",
"\n",
"# Define the path\n",
"path = \"/home/clgould99/TheBattmobile/py_packages\"\n",
"\n",
"# Check if the path exists\n",
"if os.path.exists(path):\n",
" print(\"The path exists.\")\n",
"else:\n",
" print(\"The path does not exist.\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The path exists.\n",
"/home/clgould99/TheBattmobile/py_packages\n"
]
}
],
"source": [
"import sys\n",
"sys.stdout = sys.__stdout__"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"cwd = os.getcwd()\n",
"print(cwd)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -81,7 +175,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -90,7 +184,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -106,156 +200,22 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {
"scrolled": true
},
"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>Filename</th>\n",
" <th>DateRetrieved</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>13J0016_ProfileData_20170920063536.csv</td>\n",
" <td>2017-09-20 06:36:19</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>!3J0018_ProfileData_20170920082828.csv</td>\n",
" <td>2017-09-20 08:29:04</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>13J0016_ProfileData_20180320103531.csv</td>\n",
" <td>2018-03-20 10:36:30</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>0016_ProfileData_20180731061359.csv</td>\n",
" <td>2018-07-31 06:14:11</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>0016_ProfileData_20180731063048.csv</td>\n",
" <td>2018-07-31 06:30:55</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>0016_ProfileData_20180731064002.csv</td>\n",
" <td>2018-07-31 06:40:09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>13J0016_ProfileData_20180920063036.csv</td>\n",
" <td>2018-09-20 06:30:57</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>13J0016_ProfileData_20180920063914.csv</td>\n",
" <td>2018-09-20 06:39:31</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>13j0016_ProfileData_20180920064815.csv</td>\n",
" <td>2018-09-20 06:48:27</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>13j0016_ProfileData_20180920070233.csv</td>\n",
" <td>2018-09-20 07:02:46</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>13J0016_ProfileData_20181022093417.csv</td>\n",
" <td>2018-10-22 09:34:57</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>13j0016_ProfileData_20181022100422.csv</td>\n",
" <td>2018-10-22 10:04:39</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>13j0016_ProfileData_20181205133509.csv</td>\n",
" <td>2018-12-05 13:35:24</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>13j0016_ProfileData_20181206062942.csv</td>\n",
" <td>2018-12-06 06:30:40</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>13j0016_ProfileData_20181226081031.csv</td>\n",
" <td>2018-12-26 08:11:19</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>13j0016_ProfileData_20181226122024.csv</td>\n",
" <td>2018-12-26 12:20:33</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>13j0016_ProfileData_20190121101408.csv</td>\n",
" <td>2019-01-21 10:14:16</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>13d0016_ProfileData_20190122075023.csv</td>\n",
" <td>2019-01-22 07:50:31</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Filename DateRetrieved\n",
"0 13J0016_ProfileData_20170920063536.csv 2017-09-20 06:36:19\n",
"1 !3J0018_ProfileData_20170920082828.csv 2017-09-20 08:29:04\n",
"2 13J0016_ProfileData_20180320103531.csv 2018-03-20 10:36:30\n",
"3 0016_ProfileData_20180731061359.csv 2018-07-31 06:14:11\n",
"4 0016_ProfileData_20180731063048.csv 2018-07-31 06:30:55\n",
"5 0016_ProfileData_20180731064002.csv 2018-07-31 06:40:09\n",
"6 13J0016_ProfileData_20180920063036.csv 2018-09-20 06:30:57\n",
"7 13J0016_ProfileData_20180920063914.csv 2018-09-20 06:39:31\n",
"8 13j0016_ProfileData_20180920064815.csv 2018-09-20 06:48:27\n",
"9 13j0016_ProfileData_20180920070233.csv 2018-09-20 07:02:46\n",
"10 13J0016_ProfileData_20181022093417.csv 2018-10-22 09:34:57\n",
"11 13j0016_ProfileData_20181022100422.csv 2018-10-22 10:04:39\n",
"12 13j0016_ProfileData_20181205133509.csv 2018-12-05 13:35:24\n",
"13 13j0016_ProfileData_20181206062942.csv 2018-12-06 06:30:40\n",
"14 13j0016_ProfileData_20181226081031.csv 2018-12-26 08:11:19\n",
"15 13j0016_ProfileData_20181226122024.csv 2018-12-26 12:20:33\n",
"16 13j0016_ProfileData_20190121101408.csv 2019-01-21 10:14:16\n",
"17 13d0016_ProfileData_20190122075023.csv 2019-01-22 07:50:31"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
"ename": "FileNotFoundError",
"evalue": "[Errno 2] No such file or directory: '/home/clgould99/TheBattmobile/py_packages/vis_buses/bus_1/'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[4], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m df_bus_dates \u001b[38;5;241m=\u001b[39m build_data_vis\u001b[38;5;241m.\u001b[39msort_bus_by_date(directory, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mbus_1/\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 2\u001b[0m df_bus_dates\n",
"File \u001b[0;32m~/TheBattmobile/py_packages/build_data_vis.py:27\u001b[0m, in \u001b[0;36msort_bus_by_date\u001b[0;34m(directory, bus_num)\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[38;5;66;03m# make list of all files in bus folder\u001b[39;00m\n\u001b[1;32m 26\u001b[0m csv_list \u001b[38;5;241m=\u001b[39m []\n\u001b[0;32m---> 27\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m file \u001b[38;5;129;01min\u001b[39;00m listdir(bus_directory):\n\u001b[1;32m 28\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m file\u001b[38;5;241m.\u001b[39mendswith(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m.csv\u001b[39m\u001b[38;5;124m'\u001b[39m):\n\u001b[1;32m 29\u001b[0m csv_list\u001b[38;5;241m.\u001b[39mappend(file)\n",
"\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '/home/clgould99/TheBattmobile/py_packages/vis_buses/bus_1/'"
]
}
],
"source": [
Expand Down
Loading

0 comments on commit 3bc9afd

Please sign in to comment.