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

Coerce to `'string'` broken with Pandas #1519

kwmsmith opened this Issue Jun 7, 2016 · 1 comment


None yet
2 participants

kwmsmith commented Jun 7, 2016

In [1]: import pandas as pd

In [2]: df = pd.Series([1, 2, 3])

In [3]: import blaze as bz

In [4]: bdf =

In [7]: bz.compute(bdf.coerce('string')).dtypes
Out[7]: dtype('O')

In [8]: res = bz.compute(bdf.coerce('string'))

In [10]: type(res.iloc[0])
Out[10]: int

@kwmsmith kwmsmith added this to the 0.11 milestone Jun 7, 2016


This comment has been minimized.


llllllllll commented Jun 7, 2016

this bug is also in because we find dispatch to dtype.type(value) which is np.object_(value) which is value.

For the series/daskseries case we are calling astype('O') which gives us an object array of int objects. I think we just need to special case string here and map str over the array instead.

Maybe something like:

@dispatch(Coerce, (Series, DaskSeries))
def compute_up(expr, data, **kwargs):
    if == datashape.string:
    return data.astype(to_numpy_dtype(expr.schema))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment