ssb-konjunk 0.1.18__tar.gz → 0.1.20__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/PKG-INFO +1 -1
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/pyproject.toml +1 -1
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/src/ssb_konjunk/saving.py +15 -1
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/LICENSE +0 -0
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/README.md +0 -0
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/src/ssb_konjunk/__init__.py +0 -0
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/src/ssb_konjunk/__main__.py +0 -0
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/src/ssb_konjunk/_functions.py +0 -0
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/src/ssb_konjunk/data_formating.py +0 -0
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/src/ssb_konjunk/fame.py +0 -0
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/src/ssb_konjunk/prompts.py +0 -0
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/src/ssb_konjunk/py.typed +0 -0
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/src/ssb_konjunk/rounding.py +0 -0
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/src/ssb_konjunk/statbank_format.py +0 -0
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/src/ssb_konjunk/timestamp.py +0 -0
- {ssb_konjunk-0.1.18 → ssb_konjunk-0.1.20}/src/ssb_konjunk/xml_handling.py +0 -0
|
@@ -221,9 +221,11 @@ def _verify_datatilstand(datatilstand: str) -> str:
|
|
|
221
221
|
"klargjorte-data",
|
|
222
222
|
"statistikk",
|
|
223
223
|
"utdata",
|
|
224
|
+
"logg",
|
|
225
|
+
"konfigurasjon",
|
|
224
226
|
]:
|
|
225
227
|
datatilstand = input(
|
|
226
|
-
"Datatilstanden må være enten inndata, klargjorte-data, statistikk eller utdata."
|
|
228
|
+
"Datatilstanden må være enten inndata, klargjorte-data, statistikk eller utdata (eller logg, konfigurasjon)."
|
|
227
229
|
)
|
|
228
230
|
datatilstand = _verify_datatilstand(datatilstand)
|
|
229
231
|
return datatilstand
|
|
@@ -257,6 +259,14 @@ def _save_df(
|
|
|
257
259
|
f.close()
|
|
258
260
|
else:
|
|
259
261
|
df.to_csv(file_path, sep=seperator, index=False, encoding=encoding)
|
|
262
|
+
# Save as jsonl
|
|
263
|
+
elif filetype == "jsonl":
|
|
264
|
+
df.to_json(orient="records", lines=True)
|
|
265
|
+
|
|
266
|
+
# Save as json
|
|
267
|
+
elif filetype == "json":
|
|
268
|
+
df.to_json(orient="records", lines=False)
|
|
269
|
+
|
|
260
270
|
# Uknown filetype sent as argument
|
|
261
271
|
else:
|
|
262
272
|
raise ValueError(
|
|
@@ -407,5 +417,9 @@ def read_ssb_file(
|
|
|
407
417
|
df = pd.read_csv(file_path, sep=seperator, encoding=encoding)
|
|
408
418
|
elif filetype == "parquet":
|
|
409
419
|
df = pd.read_parquet(file_path, filesystem=fs)
|
|
420
|
+
elif filetype == "jsonl":
|
|
421
|
+
df = pd.read_json(file_path, lines=True)
|
|
422
|
+
elif filetype == "json":
|
|
423
|
+
df = pd.read_json(file_path, lines=False)
|
|
410
424
|
# Returns pandas df.
|
|
411
425
|
return df
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|