From b994b54a26be328bb9a7d6faf2a29e9c5c7a6469 Mon Sep 17 00:00:00 2001 From: Nick Crews Date: Sun, 28 Aug 2022 23:18:44 -0800 Subject: [PATCH] Add xfail test for df.astype(pa.DictionaryType) Demonstration of https://github.com/vaexio/vaex/issues/2187 --- tests/astype_test.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/astype_test.py b/tests/astype_test.py index 7c9f78c48a..a2c6857e3b 100644 --- a/tests/astype_test.py +++ b/tests/astype_test.py @@ -1,5 +1,4 @@ from common import * -import collections import numpy as np def test_astype(ds_local): @@ -35,6 +34,18 @@ def test_astype_numeric(array_factory): assert df.x.astype('int').tolist() == [1, 2, None] +@pytest.mark.xfail +def test_astype_dictionary(df_factory): + arr = pa.array(["one", "two", "one"]).dictionary_encode() + # With just strings, it works fine: + # arr = pa.array(["one", "two", "one"]) + df = df_factory(x=arr) + # These work + df["x"].astype(df["x"].dtype).nop() + df["x"].astype(vaex.datatype.DataType(arr.type)).nop() + # This doesn't + df["x"].astype(arr.type).nop() + def test_astype_dtype(): df = vaex.from_arrays(x=[0, 1])