Dask AttributeError: 'DataFrame' object has no attribute '_repr_data'

Viewed 886

I have a Dask Dataframe, seems to be well loaded, however I am not able to save it, due to a '?' somewhere in the DF.

What I did:

def replace(x: pd.DataFrame) -> pd.DataFrame:
    return x.replace('?',np.nan)
ddf_short0 = ddf_short.map_partitions(replace)
ddf_short0

What it returned:

AttributeError Traceback (most recent call last) /home/user/anaconda3/lib/python3.5/site-packages/IPython/core/formatters.py in call(self, obj) 670 type_pprinters=self.type_printers, 671 deferred_pprinters=self.deferred_printers) --> 672 printer.pretty(obj) 673 printer.flush() 674 return stream.getvalue()

/home/user/anaconda3/lib/python3.5/site-packages/IPython/lib/pretty.py in pretty(self, obj) 381 if callable(meth): 382 return meth(obj, self, cycle) --> 383 return _default_pprint(obj, self, cycle) 384 finally: 385 self.end_group()

/home/user/anaconda3/lib/python3.5/site-packages/IPython/lib/pretty.py in _default_pprint(obj, p, cycle) 501 if _safe_getattr(klass, 'repr', None) not in _baseclass_reprs: 502 # A user-provided repr. Find newlines and replace them with p.break_() --> 503 _repr_pprint(obj, p, cycle) 504 return 505 p.begin_group(1, '<')

/home/user/anaconda3/lib/python3.5/site-packages/IPython/lib/pretty.py in _repr_pprint(obj, p, cycle) 699 """A pprint that just redirects to the normal repr function.""" 700 # Find newlines and replace them with p.break_() --> 701 output = repr(obj) 702 for idx,output_line in enumerate(output.splitlines()): 703 if idx:

/home/user/anaconda3/lib/python3.5/site-packages/dask/dataframe/core.py in repr(self) 392 393 def repr(self): --> 394 data = self._repr_data.to_string(max_rows=5, show_dimensions=False) 395 return """Dask {klass} Structure: 396 {data}

/home/user/anaconda3/lib/python3.5/site-packages/dask/dataframe/core.py in getattr(self, key) 2518 return new_dd_object(merge(self.dask, dsk), name, 2519
meta, self.divisions) -> 2520 raise AttributeError("'DataFrame' object has no attribute %r" % key) 2521 2522 def dir(self):

AttributeError: 'DataFrame' object has no attribute '_repr_data'

Any ideas? Thanks

0 Answers
Related