blaze / blaze/odo

TypeError: data type not understood writing a data frame with categoricals into postgres

Open
#401 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1k
Forks
131
PR merge metrics
No merged PRs in 30d

Description

odo.odo(big_dataframe, PostgresSQLURI)

---

TypeError Traceback (most recent call last)
in ()
----> 1 odo.odo(big_dataframe, PostgresSQLURI)

/Applications/anaconda/lib/python2.7/site-packages/odo/odo.pyc in odo(source, target, *_kwargs)
88 odo.append.append - Add things onto existing things
89 """
---> 90 return into(target, source, *_kwargs)

/Applications/anaconda/lib/python2.7/site-packages/multipledispatch/dispatcher.pyc in **call**(self, _args, *_kwargs)
162 self._cache[types] = func
163 try:
--> 164 return func(_args, *_kwargs)
165
166 except MDNotImplementedError:

/Applications/anaconda/lib/python2.7/site-packages/odo/into.pyc in into_string(uri, b, dshape, *_kwargs)
104 def into_string(uri, b, dshape=None, *_kwargs):
105 if dshape is None:
--> 106 dshape = discover(b)
107
108 resource_ds = 0 \* dshape.subshape[0] if isdimension(dshape[0]) else dshape

/Applications/anaconda/lib/python2.7/site-packages/multipledispatch/dispatcher.pyc in **call**(self, _args, *_kwargs)
162 self._cache[types] = func
163 try:
--> 164 return func(_args, *_kwargs)
165
166 except MDNotImplementedError:

/Applications/anaconda/lib/python2.7/site-packages/odo/backends/pandas.pyc in discover_dataframe(df)
17 obj = object_
18 names = list(df.columns)
---> 19 dtypes = list(map(datashape.CType.from_numpy_dtype, df.dtypes))
20 dtypes = [string if dt == obj else dt for dt in dtypes]
21 odtypes = [Option(dt) if dt in possibly_missing else dt

/Applications/anaconda/lib/python2.7/site-packages/datashape/coretypes.pyc in from_numpy_dtype(self, dt)
735 except KeyError:
736 pass
--> 737 if np.issubdtype(dt, np.datetime64):
738 unit, _ = np.datetime_data(dt)
739 defaults = {'D': date_, 'Y': date_, 'M': date_, 'W': date_}

/Applications/anaconda/lib/python2.7/site-packages/numpy/core/numerictypes.pyc in issubdtype(arg1, arg2)
753 """
754 if issubclass_(arg2, generic):
--> 755 return issubclass(dtype(arg1).type, arg2)
756 mro = dtype(arg2).type.mro()
757 if len(mro) > 1:

TypeError: data type not understood

> /Applications/anaconda/lib/python2.7/site-packages/numpy/core/numerictypes.py(755)issubdtype()
> 754 if issubclass_(arg2, generic):
> --> 755 return issubclass(dtype(arg1).type, arg2)
> 756 mro = dtype(arg2).type.mro()

ipdb> print(arg1)
category
ipdb> type(arg1).type

ipdb> arg2

ipdb> issubclass(dtype(arg1).type, arg2)
**\* TypeError: data type not understood
ipdb> issubclass_(arg2, generic)
True
ipdb> issubclass_(arg1, generic)
False
ipdb> issubclass_(dtype(arg1).type, generic)
**\* TypeError: data type not understood
ipdb> dtype(arg1).type
**\* TypeError: data type not understood
ipdb> issubclass_(type(arg1).type, generic)
False

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.