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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ssb-konjunk
3
- Version: 0.1.18
3
+ Version: 0.1.20
4
4
  Summary: SSB Konjunk
5
5
  License: MIT
6
6
  Author: Edvard Garmannslund
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ssb-konjunk"
3
- version = "0.1.18"
3
+ version = "0.1.20"
4
4
  description = "SSB Konjunk"
5
5
  authors = ["Edvard Garmannslund <ged@ssb.no>"]
6
6
  license = "MIT"
@@ -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