eolas-data 1.3.0__tar.gz → 1.3.1__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.
- {eolas_data-1.3.0 → eolas_data-1.3.1}/PKG-INFO +1 -1
- {eolas_data-1.3.0 → eolas_data-1.3.1}/eolas_data/client.py +5 -0
- {eolas_data-1.3.0 → eolas_data-1.3.1}/pyproject.toml +1 -1
- {eolas_data-1.3.0 → eolas_data-1.3.1}/tests/test_client.py +13 -0
- {eolas_data-1.3.0 → eolas_data-1.3.1}/.github/workflows/catalog-drift.yml +0 -0
- {eolas_data-1.3.0 → eolas_data-1.3.1}/.github/workflows/publish.yml +0 -0
- {eolas_data-1.3.0 → eolas_data-1.3.1}/.gitignore +0 -0
- {eolas_data-1.3.0 → eolas_data-1.3.1}/README.md +0 -0
- {eolas_data-1.3.0 → eolas_data-1.3.1}/eolas_data/__init__.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.3.1}/eolas_data/_dataset_names.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.3.1}/eolas_data/_regen_names.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.3.1}/eolas_data/cli.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.3.1}/eolas_data/dataset.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.3.1}/eolas_data/exceptions.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.3.1}/eolas_data/schedule.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.3.1}/tests/test_cli.py +0 -0
- {eolas_data-1.3.0 → eolas_data-1.3.1}/tests/test_schedule.py +0 -0
|
@@ -271,6 +271,11 @@ class Client:
|
|
|
271
271
|
if "date" in df.columns:
|
|
272
272
|
df["date"] = pd.to_datetime(df["date"])
|
|
273
273
|
|
|
274
|
+
# API streams from Iceberg in file order, not chronological — sort here so
|
|
275
|
+
# callers can `df.plot(x="date", y="value")` without seeing zigzag lines.
|
|
276
|
+
if "date" in df.columns:
|
|
277
|
+
df = df.sort_values("date", kind="stable").reset_index(drop=True)
|
|
278
|
+
|
|
274
279
|
result = Dataset(df)
|
|
275
280
|
result.eolas_name = name
|
|
276
281
|
result.eolas_source = ""
|
|
@@ -101,6 +101,19 @@ def test_get_returns_dataset(client):
|
|
|
101
101
|
assert df.eolas_name == "nz_cpi"
|
|
102
102
|
|
|
103
103
|
|
|
104
|
+
@resp_lib.activate
|
|
105
|
+
def test_get_sorts_rows_by_date(client):
|
|
106
|
+
# API streams Iceberg in file order, not chronological — client must sort.
|
|
107
|
+
unsorted = [
|
|
108
|
+
{"date": "2023-04-01", "period": "2023Q2", "value": 101.5},
|
|
109
|
+
{"date": "2022-01-01", "period": "2022Q1", "value": 99.0},
|
|
110
|
+
{"date": "2023-01-01", "period": "2023Q1", "value": 100.0},
|
|
111
|
+
]
|
|
112
|
+
resp_lib.add(resp_lib.GET, f"{BASE}/v1/datasets/nz_cpi/data", json={"data": unsorted})
|
|
113
|
+
df = client.get("nz_cpi")
|
|
114
|
+
assert list(df["date"].dt.strftime("%Y-%m-%d")) == ["2022-01-01", "2023-01-01", "2023-04-01"]
|
|
115
|
+
|
|
116
|
+
|
|
104
117
|
@resp_lib.activate
|
|
105
118
|
def test_get_passes_date_params(client):
|
|
106
119
|
resp_lib.add(resp_lib.GET, f"{BASE}/v1/datasets/nz_cpi/data", json={"data": RECORDS})
|
|
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
|