Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20240822 leo feilmeldinger #52

Merged
merged 6 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
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
13 changes: 6 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/ssb_konjunk/saving.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ def read_ssb_file(
seperator: the seperator to use it filetype is csv. Default: ';'.
encoding: Encoding for file, base is latin1.

Raises:
FileNotFoundError: If no files matching the file path and filetype are found.

Returns:
pd.DataFrame: file as a data frame.
"""
Expand All @@ -376,6 +379,12 @@ def read_ssb_file(
if not version_number:
# If version number not specified then list out versions.
files = _get_files(file_path, filetype, fs=fs)
# If list is empty, no matching files of any version were found.
if not files:
raise FileNotFoundError(
f"Fant ingen {filetype}-filer som matcher filstien '{file_path}'."
)
# Otherwise, use the newest version of file.
file_path = files[-1]

# Different functions used for reading depending on the filetype.
Expand Down
Loading