Skip to content

Commit

Permalink
Merge pull request #54 from statisticsnorway/20240822LeoPandasStubs
Browse files Browse the repository at this point in the history
prøver å se om dette fikser missing stubs
  • Loading branch information
joxssb authored Aug 22, 2024
2 parents ee93c88 + 8c76744 commit 1a888ac
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ click = ">=8.0.1"
pandas = "^2.2.0"
pendulum = "^3.0.0"
dapla-toolbelt = "^2.0.19"
pandas-stubs = "^2.2.2.240807"

[tool.poetry.group.dev.dependencies]
pygments = ">=2.10.0"
Expand All @@ -38,7 +39,6 @@ sphinx-click = ">=3.0.2"
typeguard = ">=2.13.3"
xdoctest = { extras = ["colors"], version = ">=0.15.10" }
myst-parser = { version = ">=0.16.1" }
pandas-stubs = "<=2.2.2.240603"


[tool.pytest.ini_options]
Expand Down
16 changes: 8 additions & 8 deletions src/ssb_konjunk/fame.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@
fs = FileClient.get_gcs_file_system()


def change_date_format_fame(series: pd.Series) -> pd.Series:
def change_date_format_fame(series: pd.Series[str]) -> pd.Series[str]:
"""Function for turning ISO-8601 to fame time format.
Args:
series: A pandas series containing string for dates in format ISO-8601(YYYY-mm-dd).
series: A pandas series containing strings for dates in format ISO-8601(YYYY-mm-dd).
Returns:
pd.Series: A pandas series with dates in fame format(YYYY:M:D)
pd.Series: A pandas series with dates in fame format (YYYY:M:D)
"""
series = pd.to_datetime(series)
series_dt = pd.to_datetime(series) # Series of datetime64

# Format the datetime column as "YYYY:M:D"
series = series.dt.strftime("%Y:%-m:%-d")
series = series_dt.dt.strftime("%Y:%-m:%-d")

return series


def write_out_fame_format_txt(
names: pd.Series,
dates: pd.Series,
values: pd.Series,
names: pd.Series[str],
dates: pd.Series[str],
values: pd.Series[float],
gcp_path: str,
) -> None:
"""Function to write out txt file in fame format.
Expand Down
2 changes: 1 addition & 1 deletion src/ssb_konjunk/saving.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def write_ssb_file(
# Veirfy name of datatilstand and base filename
file_name = _verify_base_filename(file_name)
# Verify 'datatilstand' if not the kortnavn is temp or oppdrag
if not kortnavn.lower().isin(["temp", "oppdrag"]):
if kortnavn.lower() not in ["temp", "oppdrag"]:
datatilstand = _verify_datatilstand(datatilstand)
# Get the filepath, only without version number and filetype
file_path = _structure_ssb_filepath(
Expand Down

0 comments on commit 1a888ac

Please sign in to comment.