Nostradamus
Nostradamus copied to clipboard
cross-platform file paths
Instead of this path parsing one-liner...
existing_files = [file.split('/')[2] for file in glob.glob(prices_folder + '*')]
I'm running on Windows and not Mac or linux. The filepath returns "" and not "/".
I solved this by using "from pathlib import Path" and replacing this one-liner with:
existing_files = [Path(file).name for file in glob.glob(prices_folder + '*')]
I replaced about ~20 different file path instances relying on '/' split. Using pathlib .name and .path should solve all of these issues.
folder_name = subdirectory.split('/')[1][:-1]
description = subdirectory.split('/')[2]
For these, I used "from pathlib import PurePath" like so:
folder_name = PurePath(subdirectory).parts[1][:-1]
description = PurePath(subdirectory).parts[2]
Thought you might be interested in changing this, too.
Also, I've trained the model and now I'm testing. The "test" has been running for over 30+ and still running. I have a powerful computer with 32gb RAM. Is this normal?