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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eolas-data
3
- Version: 1.3.0
3
+ Version: 1.3.1
4
4
  Summary: Python client for the eolas.fyi statistical data API (NZ, Australia, OECD)
5
5
  Project-URL: Homepage, https://eolas.fyi
6
6
  Project-URL: Documentation, https://docs.eolas.fyi/
@@ -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 = ""
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "eolas-data"
7
- version = "1.3.0"
7
+ version = "1.3.1"
8
8
  description = "Python client for the eolas.fyi statistical data API (NZ, Australia, OECD)"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -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