Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1970 Improve Error Handling in to_dask_array for Non-Numeric Columns #2431

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/vaex-core/vaex/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3417,6 +3417,13 @@ def to_dask_array(self, chunks="auto"):
"""
import dask.array as da
import uuid
import numpy as np

#Check for non-numeric columns
non_numeric_columns= [col for col in self.columns if not np.issubdtype(self[col].dtype, np.number)]
if non_numeric_columns:
raise TypeError(f"Cannot Convert non-numeric columns to Dask array. Non-numeric columns: {non_numeric_columns}")

dtype = self._dtype
chunks = da.core.normalize_chunks(chunks, shape=self.shape, dtype=dtype.numpy)
name = 'vaex-df-%s' % str(uuid.uuid1())
Expand Down
Loading