Skip to content

Commit

Permalink
QError for mixed lists (suggested by Kx)
Browse files Browse the repository at this point in the history
  • Loading branch information
chraberturas committed Jan 18, 2024
1 parent 60ea6bb commit 2aa3a6e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 0 additions & 2 deletions src/pykx/pandas_api/pandas_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,6 @@ def sum(self, axis=0, skipna=True, numeric_only=False, min_count=0):
@convert_result
def nunique(self, axis=0, dropna=True):
res, cols = preparse_computations(self, axis, skipna=False)
if q("any('[1<>count distinct@;type']')@", res).py():
raise NotImplementedError("Table contains a column whose type is mixed")
filterNan = q('{$[all[10h=type each x]|11h = type x;x;'
'x where not null x]}each')
res = filterNan(res) if dropna else res
Expand Down
3 changes: 1 addition & 2 deletions tests/test_pandas_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2061,6 +2061,5 @@ def test_nunique(kx, q):
assert p_m[c] == q_m[c].py()

tab = kx.q('([]a:("";" ";"";"foo"))')
with pytest.raises(NotImplementedError,
match=r"Table contains a column whose type is mixed"):
with pytest.raises(kx.QError):
raise tab.nunique()

0 comments on commit 2aa3a6e

Please sign in to comment.