Skip to content

Commit ae2aadc

Browse files
authored
revert Dataset.pl; it needs pyarrow after all
1 parent 6e95a80 commit ae2aadc

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

affinity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def arrow(self) -> "pa.Table":
348348

349349
@property
350350
def pl(self) -> "pl.DataFrame":
351-
return pl.DataFrame(self.dict)
351+
return pl.DataFrame(dict(self))
352352

353353
def is_dataset(self, key):
354354
attr = getattr(self, key, None)

pyproject.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,9 @@ dependencies = [
1919

2020
[dependency-groups]
2121
dev = [
22-
"pytest>=8",
23-
]
24-
polars = [
2522
"polars>=1",
26-
]
27-
pyarrow = [
2823
"pyarrow>=17",
24+
"pytest>=8",
2925
]
3026

3127
[tool.hatch.build]

test_affinity.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,15 @@ class aDataset(af.Dataset):
259259

260260

261261
@pytest.mark.skipif(NO_POLARS, reason="polars is not installed")
262+
@pytest.mark.skipif(NO_PYARROW, reason="pyarrow is not installed")
262263
def test_to_polars():
263264
class aDataset(af.Dataset):
264265
v1 = af.VectorBool("")
265266
v2 = af.VectorF32("")
266267
v3 = af.VectorI16("")
267268

268269
data = aDataset(v1=[True], v2=[1 / 2], v3=[999])
270+
# this requires polars AND pyarrow because conversion goes via pd.Series
269271
polars_df = data.pl
270272
assert str(polars_df.dtypes) == "[Boolean, Float32, Int16]"
271273

0 commit comments

Comments
 (0)