diff --git a/daft/series.py b/daft/series.py index 80e52aa272..74724c740e 100644 --- a/daft/series.py +++ b/daft/series.py @@ -106,7 +106,7 @@ def from_pylist(data: list, name: str = "list_series", pyobj: str = "allow") -> except pa.lib.ArrowInvalid: if pyobj == "disallow": raise - pys = PySeries.from_pylist(name, data) + pys = PySeries.from_pylist(name, data, pyobj=pyobj) return Series._from_pyseries(pys) @classmethod diff --git a/tests/dataframe/test_logical_type.py b/tests/dataframe/test_logical_type.py index d3d5224b72..60660fc96e 100644 --- a/tests/dataframe/test_logical_type.py +++ b/tests/dataframe/test_logical_type.py @@ -32,7 +32,7 @@ def test_image_type_df(from_pil_imgs) -> None: ] if from_pil_imgs: data = [Image.fromarray(arr, mode="RGB") if arr is not None else None for arr in data] - df = daft.from_pydict({"index": np.arange(len(data)), "image": Series.from_pylist(data, pyobj="force")}) + df = daft.from_pydict({"index": np.arange(len(data)), "image": Series.from_pylist(data, pyobj="allow")}) image_expr = col("image") if not from_pil_imgs: diff --git a/tests/series/test_image.py b/tests/series/test_image.py index 99c658aaf9..68933206ac 100644 --- a/tests/series/test_image.py +++ b/tests/series/test_image.py @@ -178,7 +178,7 @@ def test_image_pil_inference(fixed_shape, mode): if arr is not None: arr[..., -1] = 255 imgs = [Image.fromarray(arr, mode=mode) if arr is not None else None for arr in arrs] - s = Series.from_pylist(imgs, pyobj="force") + s = Series.from_pylist(imgs, pyobj="allow") assert s.datatype() == DataType.image(mode) out = s.to_pylist() if num_channels == 1: @@ -206,7 +206,12 @@ def test_image_pil_inference_mixed(): else None for arr in arrs ] + + # Forcing should still create Python Series s = Series.from_pylist(imgs, pyobj="force") + assert s.datatype() == DataType.python() + + s = Series.from_pylist(imgs, pyobj="allow") assert s.datatype() == DataType.image() out = s.to_pylist() arrs[3] = np.expand_dims(arrs[3], axis=-1)