Skip to content

Commit

Permalink
Merge pull request #93 from statisticsnorway/expand_versions
Browse files Browse the repository at this point in the history
Expand versions, statistikkregister - debug v1.0.0 -> v1.0.1
  • Loading branch information
aecorn authored Aug 8, 2024
2 parents 4f0d1cd + aa76173 commit acd1e7d
Show file tree
Hide file tree
Showing 15 changed files with 937 additions and 183 deletions.
2 changes: 1 addition & 1 deletion demos/all_combos_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_grand_total() -> None:
result = all_combos_agg(
data_in,
["sex", "age"],
{"points": sum},
{"points": "sum"},
fillna_dict={"sex": "Begge kjoenn", "age": "Alle aldre"},
keep_empty=True,
grand_total="I alt",
Expand Down
41 changes: 38 additions & 3 deletions demos/statistikkregisteret.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,47 @@
# ---

# %%
import os
from fagfunksjoner.api import statistikkregisteret as reg


# %%
shortcode = "vgu"

# %%
single = reg.single_stat()

# %%
print(single.navn.navn[0].text)
print(single.eierseksjon.statid)
for kontaktinfo in single.kontakter:
for kontakt in kontaktinfo.navn:
if kontakt.lang == "no":
print(kontakt.text)

# %%
reg.find_stat_shortcode(shortcode)

# %%
reg.find_latest_publishing(shortcode)

# %%
reg.find_publishings()

# %%
reg.specific_publishing()

# %%
reg.time_until_publishing("vgu")

# %%
import datetime

os.chdir("../")
from fagfunksjoner.api import statistikkregisteret as reg


kortkode = "vgu"

if not datetime.timedelta(0) < reg.time_until_publishing(kortkode):
raise ValueError("HAR DU IKKE MELDT PUBLISERING!?!?!?")

# %%
reg.find_latest_publishing("vgu")
5 changes: 0 additions & 5 deletions demos/view_dataframe_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# This is a demo of the function view_dataframe. view_dataframe views a dataframe in a dynamically way using ipywidgets

# %%
import ipywidgets
import numpy as np
import pandas as pd
from IPython.display import display
Expand All @@ -27,10 +26,6 @@
from fagfunksjoner import view_dataframe


# %%
ipywidgets.interactive()


# %% [markdown]
# ## Generate test data
# Here is a function that generates some test data. We can choose the share of missing values we shall have on the column 'value'
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ssb-fagfunksjoner"
version = "1.0.0"
version = "1.0.1"
description = "Fellesfunksjoner for ssb i Python"
authors = ["SSB-pythonistas <ssb-pythonistas@ssb.no>"]
license = "MIT"
Expand Down
7 changes: 2 additions & 5 deletions src/fagfunksjoner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,14 @@ def _try_getting_pyproject_toml(e: Exception | None = None) -> str:
from fagfunksjoner.data.pandas_dtypes import auto_dtype
from fagfunksjoner.data.view_dataframe import view_dataframe
from fagfunksjoner.paths.project_root import ProjectRoot
from fagfunksjoner.paths.versions import (
get_latest_fileversions,
get_next_version_number,
)
from fagfunksjoner.paths.versions import get_latest_fileversions, next_version_path
from fagfunksjoner.prodsone.check_env import check_env, linux_shortcuts
from fagfunksjoner.prodsone.saspy_ssb import saspy_df_from_path, saspy_session


__all__ = [
"ProjectRoot",
"get_next_version_number",
"next_version_path",
"get_latest_fileversions",
"all_combos_agg",
"auto_dtype",
Expand Down
Loading

0 comments on commit acd1e7d

Please sign in to comment.