alteryx / alteryx/woodwork

Woodwork not initialized after to_pandas call with Koalas categorical column

Abierto
#1,071 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
Python
Estrellas
155
Forks
24
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

After calling to_pandas on a koalas dataframe with a categorical column that has been initialized by woodwork, we'd expect to receive a pandas dataframe that has woodwork initialized. However, we get a `WoodworkNotInitError`.
#### Code Sample

``` python
import pandas as pd
import woodwork as ww
df = pd.DataFrame({'categorical': pd.Series(["a", "b", "c", "a"], dtype="category")})
ks_df = ks.from_pandas(df)
ks_df.ww.init(name='woodwork')
pd_df = ks_df.ww.to_pandas()
pd_df.ww
```
#### Stack Trace
``` python
---------------------------------------------------------------------------
WoodworkNotInitError Traceback (most recent call last)
~/Documents/woodwork/venv/lib/python3.8/site-packages/IPython/core/formatters.py in __call__(self, obj)
700 type_pprinters=self.type_printers,
701 deferred_pprinters=self.deferred_printers)
--> 702 printer.pretty(obj)
703 printer.flush()
704 return stream.getvalue()

~/Documents/woodwork/venv/lib/python3.8/site-packages/IPython/lib/pretty.py in pretty(self, obj)
392 if cls is not object \
393 and callable(cls.__dict__.get('__repr__')):
--> 394 return _repr_pprint(obj, self, cycle)
395
396 return _default_pprint(obj, self, cycle)

~/Documents/woodwork/venv/lib/python3.8/site-packages/IPython/lib/pretty.py in _repr_pprint(obj, p, cycle)
698 """A pprint that just redirects to the normal repr function."""
699 # Find newlines and replace them with p.break_()
--> 700 output = repr(obj)
701 lines = output.splitlines()
702 with p.group():

~/Documents/woodwork/woodwork/table_accessor.py in __repr__(self)
217 def __repr__(self):
218 """A string representation of a Woodwork table containing typing information"""
--> 219 return repr(self._get_typing_info())
220
221 def _repr_html_(self):

~/Documents/woodwork/woodwork/table_accessor.py in _get_typing_info(self)
227 """Creates a DataFrame that contains the typing information for a Woodwork table."""
228 if self._schema is None:
--> 229 _raise_init_error()
230 typing_info = self._schema._get_typing_info().copy()
231 typing_info.insert(0, 'Physical Type', pd.Series(self.physical_types))

~/Documents/woodwork/woodwork/table_accessor.py in _raise_init_error()
968
969 def _raise_init_error():
--> 970 raise WoodworkNotInitError("Woodwork not initialized for this DataFrame. Initialize by calling DataFrame.ww.init")
971
972

WoodworkNotInitError: Woodwork not initialized for this DataFrame. Initialize by calling DataFrame.ww.init

---------------------------------------------------------------------------
WoodworkNotInitError Traceback (most recent call last)
~/Documents/woodwork/venv/lib/python3.8/site-packages/IPython/core/formatters.py in __call__(self, obj)
343 method = get_real_method(obj, self.print_method)
344 if method is not None:
--> 345 return method()
346 return None
347 else:

~/Documents/woodwork/woodwork/table_accessor.py in _repr_html_(self)
222 """An HTML representation of a Woodwork table for IPython.display in Jupyter Notebooks
223 containing typing information and a preview of the data."""
--> 224 return self._get_typing_info().to_html()
225
226 def _get_typing_info(self):

~/Documents/woodwork/woodwork/table_accessor.py in _get_typing_info(self)
227 """Creates a DataFrame that contains the typing information for a Woodwork table."""
228 if self._schema is None:
--> 229 _raise_init_error()
230 typing_info = self._schema._get_typing_info().copy()
231 typing_info.insert(0, 'Physical Type', pd.Series(self.physical_types))

~/Documents/woodwork/woodwork/table_accessor.py in _raise_init_error()
968
969 def _raise_init_error():
--> 970 raise WoodworkNotInitError("Woodwork not initialized for this DataFrame. Initialize by calling DataFrame.ww.init")
971
972

WoodworkNotInitError: Woodwork not initialized for this DataFrame. Initialize by calling DataFrame.ww.init
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.