ssb-konjunk 0.1.22__py3-none-any.whl → 1.0.1__py3-none-any.whl
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/saving.py +19 -4
- {ssb_konjunk-0.1.22.dist-info → ssb_konjunk-1.0.1.dist-info}/METADATA +4 -5
- {ssb_konjunk-0.1.22.dist-info → ssb_konjunk-1.0.1.dist-info}/RECORD +6 -6
- {ssb_konjunk-0.1.22.dist-info → ssb_konjunk-1.0.1.dist-info}/WHEEL +1 -1
- {ssb_konjunk-0.1.22.dist-info → ssb_konjunk-1.0.1.dist-info}/LICENSE +0 -0
- {ssb_konjunk-0.1.22.dist-info → ssb_konjunk-1.0.1.dist-info}/entry_points.txt +0 -0
ssb_konjunk/saving.py
CHANGED
|
@@ -5,6 +5,7 @@ Follows the the standardization for versioning and names.
|
|
|
5
5
|
|
|
6
6
|
import glob
|
|
7
7
|
import re
|
|
8
|
+
import warnings
|
|
8
9
|
|
|
9
10
|
import dapla
|
|
10
11
|
import pandas as pd
|
|
@@ -350,6 +351,7 @@ def read_ssb_file(
|
|
|
350
351
|
datatilstand: str = "",
|
|
351
352
|
undermappe: str | None = None,
|
|
352
353
|
filetype: str = "parquet",
|
|
354
|
+
columns: list[str] | None = None,
|
|
353
355
|
version_number: int | None = None,
|
|
354
356
|
fs: dapla.gcs.GCSFileSystem | None = None,
|
|
355
357
|
seperator: str = ";",
|
|
@@ -371,6 +373,7 @@ def read_ssb_file(
|
|
|
371
373
|
undermappe: Optional folder under 'datatilstand'.
|
|
372
374
|
version_number: possibility to get another version, than the newest (i.e. highest version number). Default: np.nan.
|
|
373
375
|
filetype: the filetype to save as. Default: 'parquet'.
|
|
376
|
+
columns: Columns to read from the file. If None (default), all columns are read.
|
|
374
377
|
fs: the filesystem, pass with gsc Filesystem if Dapla. Default: None.
|
|
375
378
|
seperator: the seperator to use it filetype is csv. Default: ';'.
|
|
376
379
|
encoding: Encoding for file, base is latin1.
|
|
@@ -411,15 +414,27 @@ def read_ssb_file(
|
|
|
411
414
|
if fs:
|
|
412
415
|
# Samme som tidligere kan brukes til å lese alle filformater.
|
|
413
416
|
with fs.open(file_path, "r") as f:
|
|
414
|
-
df = pd.read_csv(f, sep=seperator, encoding=encoding)
|
|
417
|
+
df = pd.read_csv(f, sep=seperator, encoding=encoding, usecols=columns)
|
|
415
418
|
f.close()
|
|
416
419
|
else:
|
|
417
|
-
df = pd.read_csv(
|
|
420
|
+
df = pd.read_csv(
|
|
421
|
+
file_path, sep=seperator, encoding=encoding, usecols=columns
|
|
422
|
+
)
|
|
418
423
|
elif filetype == "parquet":
|
|
419
|
-
df = pd.read_parquet(file_path, filesystem=fs)
|
|
424
|
+
df = pd.read_parquet(file_path, columns=columns, filesystem=fs)
|
|
420
425
|
elif filetype == "jsonl":
|
|
421
|
-
|
|
426
|
+
if columns is not None:
|
|
427
|
+
warnings.warn(
|
|
428
|
+
f"Columns argumentet blir ignorert for {filetype} filer, hele filen vil bli lastet inn.",
|
|
429
|
+
stacklevel=2,
|
|
430
|
+
)
|
|
431
|
+
df = pd.read_json(file_path, lines=False)
|
|
422
432
|
elif filetype == "json":
|
|
433
|
+
if columns is not None:
|
|
434
|
+
warnings.warn(
|
|
435
|
+
f"Columns argumentet blir ignorert for {filetype} filer, hele filen vil bli lastet inn.",
|
|
436
|
+
stacklevel=2,
|
|
437
|
+
)
|
|
423
438
|
df = pd.read_json(file_path, lines=False)
|
|
424
439
|
# Returns pandas df.
|
|
425
440
|
return df
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: ssb-konjunk
|
|
3
|
-
Version: 0.1
|
|
4
|
-
Summary: SSB Konjunk
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: SSB Konjunk 422
|
|
5
5
|
License: MIT
|
|
6
|
-
Author:
|
|
7
|
-
Author-email:
|
|
6
|
+
Author: Johanne Saxegaard
|
|
7
|
+
Author-email: jox@ssb.no
|
|
8
8
|
Requires-Python: >=3.10,<4.0
|
|
9
9
|
Classifier: Development Status :: 1 - Planning
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -44,7 +44,6 @@ Description-Content-Type: text/markdown
|
|
|
44
44
|
[pypi status]: https://pypi.org/project/ssb-konjunk/
|
|
45
45
|
[documentation]: https://statisticsnorway.github.io/ssb-konjunk
|
|
46
46
|
[tests]: https://github.com/statisticsnorway/ssb-konjunk/actions?workflow=Tests
|
|
47
|
-
|
|
48
47
|
[sonarcov]: https://sonarcloud.io/summary/overall?id=statisticsnorway_ssb-konjunk
|
|
49
48
|
[sonarquality]: https://sonarcloud.io/summary/overall?id=statisticsnorway_ssb-konjunk
|
|
50
49
|
[pre-commit]: https://github.com/pre-commit/pre-commit
|
|
@@ -6,12 +6,12 @@ ssb_konjunk/fame.py,sha256=6Yw0D1kY20yOu49DHgwfSIAmiHVCERuMeIANg1lYu64,1619
|
|
|
6
6
|
ssb_konjunk/prompts.py,sha256=tGI2dARh8jIYB_IZ4Iwb5AEbNoDZq9-17Uc9QjhqPcQ,10269
|
|
7
7
|
ssb_konjunk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
ssb_konjunk/rounding.py,sha256=nbxYMvvFzoJOxwJBCA80OyaZGhhOHCxbndeYB271Uzk,1269
|
|
9
|
-
ssb_konjunk/saving.py,sha256=
|
|
9
|
+
ssb_konjunk/saving.py,sha256=dBevCnurC4IBeMlrs1Ut1ymhM6Cg6kvRIyYbw0ujCmw,15658
|
|
10
10
|
ssb_konjunk/statbank_format.py,sha256=cVXrq2qSuMk-FAiMdbIS8Cc8YgZUyTCKnsMdknMbfkM,1469
|
|
11
11
|
ssb_konjunk/timestamp.py,sha256=XPB5JhZQdDgUPYYNVAFiMZGe8dYL8seb_k98G9CNtjY,9960
|
|
12
12
|
ssb_konjunk/xml_handling.py,sha256=kvAZ699iOSxHCi2ksEGroFk60-ufsRW7b_m3j47A2gY,1726
|
|
13
|
-
ssb_konjunk-0.1.
|
|
14
|
-
ssb_konjunk-0.1.
|
|
15
|
-
ssb_konjunk-0.1.
|
|
16
|
-
ssb_konjunk-0.1.
|
|
17
|
-
ssb_konjunk-0.1.
|
|
13
|
+
ssb_konjunk-1.0.1.dist-info/LICENSE,sha256=np3IfD5m0ZUofn_kVzDZqliozuiO6wrktw3LRPjyEiI,1073
|
|
14
|
+
ssb_konjunk-1.0.1.dist-info/METADATA,sha256=AkGNdqye185eaXSRqhaitwYxTGfgY29xuhfUo4gFaO4,3947
|
|
15
|
+
ssb_konjunk-1.0.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
16
|
+
ssb_konjunk-1.0.1.dist-info/entry_points.txt,sha256=qU7y58sZiFKYonuEJTbV0MhhbAJtposy46crLp4TjAM,57
|
|
17
|
+
ssb_konjunk-1.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|