diff --git a/python/cudf/cudf/core/column/string.py b/python/cudf/cudf/core/column/string.py index 06b5ac31ca6..6c36c0ee2fd 100644 --- a/python/cudf/cudf/core/column/string.py +++ b/python/cudf/cudf/core/column/string.py @@ -4843,6 +4843,7 @@ def character_ngrams( result = self._return_or_inplace(lc, retain_index=True) if isinstance(result, cudf.Series) and not as_list: + result = result[result.list.len() > 0] # before exploding, removes those lists which have 0 length return result.explode() return result