Skip to content

Commit 0d6a9a1

Browse files
committed
Release v0.0.113 with Polars/Arrow speedups
1 parent d1f285a commit 0d6a9a1

16 files changed

Lines changed: 424 additions & 105 deletions
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:f8cbbcd83c58ab1c7a711338003553599919e1f8a1c9f1576406904493b1012f
3-
size 259493888
2+
oid sha256:c26d4dc73740fb798315f7447365c57e004757d126481b2371ca88ee565f0e8b
3+
size 259403776
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:6a3dd6d364d372719d6208dd33b594ba09ed02a13552daa333f1f51613d5294c
2+
oid sha256:026e07a67363a0d163e196ec98edfcf9e1cc567531941e9464f15b16512ce241
33
size 317960192
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:61670ea71e1d14a245420a884c406efcce72188bfd6dd3b8faaceca05e3b0706
3-
size 30717546
2+
oid sha256:fc5cd1f3118b6d3a38d33c02a3630f7418a462e2960169305c9d1241e559ba52
3+
size 30896931
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:dc605919048190e61ad82d2451086a71d184301448d7e094f60474db3e8260e6
3-
size 525
2+
oid sha256:d2a06b4b61f75bd97fd886f2eec8836b7cc1679562f33cbbfebed848647bba43
3+
size 524

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "teadata"
7-
version = "0.0.112"
7+
version = "0.0.113"
88
description = "Pythonic data engine for Texas education datasets"
99
authors = [{name="Alejandro Peña", email="adpena@gmail.com"}]
1010
readme = "README.md"
@@ -42,6 +42,7 @@ classifiers = [
4242
# Faster I/O / performance add-ons
4343
speedups = [
4444
"pyogrio>=0.7",
45+
"polars>=1.0",
4546
"pygeos; python_version<'3.11'", # no-op on modern, left for legacy envs
4647
]
4748

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:f8cbbcd83c58ab1c7a711338003553599919e1f8a1c9f1576406904493b1012f
3-
size 259493888
2+
oid sha256:c26d4dc73740fb798315f7447365c57e004757d126481b2371ca88ee565f0e8b
3+
size 259403776
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:6a3dd6d364d372719d6208dd33b594ba09ed02a13552daa333f1f51613d5294c
2+
oid sha256:026e07a67363a0d163e196ec98edfcf9e1cc567531941e9464f15b16512ce241
33
size 317960192
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:61670ea71e1d14a245420a884c406efcce72188bfd6dd3b8faaceca05e3b0706
3-
size 30717546
2+
oid sha256:fc5cd1f3118b6d3a38d33c02a3630f7418a462e2960169305c9d1241e559ba52
3+
size 30896931
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:dc605919048190e61ad82d2451086a71d184301448d7e094f60474db3e8260e6
3-
size 525
2+
oid sha256:d2a06b4b61f75bd97fd886f2eec8836b7cc1679562f33cbbfebed848647bba43
3+
size 524

teadata/engine.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,30 +3014,25 @@ def norm(x):
30143014
dst_series = df[dst_col].map(norm)
30153015
counts = df[count_col].to_numpy()
30163016

3017-
# Local cache to avoid repeated lookups against _campus_by_number
3017+
# Precompute campus-id lookups for all observed normalized keys
30183018
id_cache: Dict[str, Optional[uuid.UUID]] = {}
3019-
3020-
def _lookup(normed: str | None) -> Optional[uuid.UUID]:
3021-
if normed is None:
3022-
return None
3023-
hit = id_cache.get(normed)
3024-
if hit is not None or normed in id_cache:
3025-
return hit
3019+
observed_keys = set(src_series.dropna())
3020+
observed_keys.update(dst_series.dropna())
3021+
for normed in observed_keys:
30263022
digits = normed[1:] if normed.startswith("'") else normed
3027-
cid = self._campus_by_number.get(normed) or self._campus_by_number.get(
3028-
digits
3029-
)
3030-
id_cache[normed] = cid
3031-
return cid
3023+
id_cache[normed] = self._campus_by_number.get(
3024+
normed
3025+
) or self._campus_by_number.get(digits)
30323026

3033-
for src_key, dst_key, raw in zip(
3034-
src_series.to_numpy(), dst_series.to_numpy(), counts
3027+
src_ids = src_series.map(id_cache).to_numpy()
3028+
dst_ids = dst_series.map(id_cache).to_numpy()
3029+
3030+
for src_key, dst_key, src_id, dst_id, raw in zip(
3031+
src_series.to_numpy(), dst_series.to_numpy(), src_ids, dst_ids, counts
30353032
):
30363033
if not src_key or not dst_key:
30373034
continue
30383035

3039-
src_id = _lookup(src_key)
3040-
dst_id = _lookup(dst_key)
30413036
if src_id is None or dst_id is None:
30423037
if src_id is None and dst_id is None:
30433038
self._xfers_missing["either"] = (
@@ -3072,9 +3067,6 @@ def _sort_key(edge):
30723067

30733068
for k in list(self._xfers_in.keys()):
30743069
# for transfers_in sort by the incoming count, same logic
3075-
from_id, cnt, _ = (
3076-
self._xfers_in[k][0] if self._xfers_in[k] else (None, None, None)
3077-
)
30783070
self._xfers_in[k].sort(
30793071
key=lambda ed: (
30803072
-(ed[1] or -1),

0 commit comments

Comments
 (0)