Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parquet protocol #43

Merged
merged 17 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ jobs:
pytest

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v3
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,6 @@ dmypy.json

# Pyre type checker
.pyre/

# PyCharm
.idea/
13 changes: 1 addition & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ repos:
rev: 6.0.0
hooks:
- id: flake8
args: ["--ignore=E501"]
## You can add flake8 plugins via `additional_dependencies`:
# additional_dependencies: [flake8-bugbear]
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args:
[
"-rn", # Only display messages
"-sn", # Don't display the score
]
8 changes: 7 additions & 1 deletion bw_processing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"generic_zipfile_filesystem",
"INDICES_DTYPE",
"load_datapackage",
"MatrixSerializeFormat",
"md5",
"merge_datapackages_with_mask",
"reindex",
Expand All @@ -29,7 +30,12 @@


from .array_creation import create_array, create_structured_array
from .constants import DEFAULT_LICENSES, INDICES_DTYPE, UNCERTAINTY_DTYPE
from .constants import (
DEFAULT_LICENSES,
INDICES_DTYPE,
UNCERTAINTY_DTYPE,
MatrixSerializeFormat,
)
from .datapackage import (
Datapackage,
DatapackageBase,
Expand Down
17 changes: 17 additions & 0 deletions bw_processing/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re
from enum import Enum

import numpy as np

Expand Down Expand Up @@ -30,3 +31,19 @@
"title": "Open Data Commons Public Domain Dedication and License v1.0",
}
]


class MatrixSerializeFormat(str, Enum):
"""
Enum with the serializing formats for the vectors and matrices.
"""

NUMPY = "numpy" # numpy .npy format
PARQUET = "parquet" # Apache .parquet format


# FILE EXTENSIONS
NUMPY_SERIALIZE_FORMAT_EXTENSION = ".npy"
NUMPY_SERIALIZE_FORMAT_NAME = "npy"
PARQUET_SERIALIZE_FORMAT_EXTENSION = ".parquet"
PARQUET_SERIALIZE_FORMAT_NAME = "pqt"
Loading