# Buggy code
def _set_inputs(self, inputs):
    super()._set_inputs(inputs)
    if len(self._inputs) == 2:
        self._lhs = self._inputs[0]
        self._rhs = self._inputs[1]
    else:
        if isinstance(self._lhs, (DATAFRAME_TYPE, SERIES_TYPE)):
            self._lhs = self._inputs[0]
        elif np.isscalar(self._lhs):
            self._rhs = self._inputs[0]


# Traceback (TypeError)
In [25]: df = md.DataFrame(mt.random.rand(10, 3), chunk_size=3)

In [26]: df.sort_values(0).reset_index(drop=True).execute()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-26-e0c111d55eb4> in <module>
----> 1 df.sort_values(0).reset_index(drop=True).execute()

~/Documents/mars_dev/mars/mars/core.py in execute(self, session, **kw)
559
560     def execute(self, session=None, **kw):
--> 561         self._data.execute(session, **kw)
562         return self
563

~/Documents/mars_dev/mars/mars/core.py in execute(self, session, **kw)
368
369         # no more fetch, thus just fire run
--> 370         session.run(self, **kw)
371         # return Tileable or ExecutableTuple itself
372         return self

~/Documents/mars_dev/mars/mars/session.py in run(self, *tileables, **kw)
430         tileables = tuple(mt.tensor(t) if not isinstance(t, (Entity, Base)) else t
431                           for t in tileables)
--> 432         result = self._sess.run(*tileables, **kw)
433
434         for t in tileables:

~/Documents/mars_dev/mars/mars/session.py in run(self, *tileables, **kw)
98             # set number of running cores
99             self.context.set_ncores(kw['n_parallel'])
--> 100             res = self._executor.execute_tileables(tileables, **kw)
101             return res
102

~/Documents/mars_dev/mars/mars/utils.py in _wrapped(*args, **kwargs)
383                 _kernel_mode.eager = False
384             _kernel_mode.eager_count = enter_eager_count + 1
--> 385             return func(*args, **kwargs)
386         finally:
387             _kernel_mode.eager_count -= 1

~/Documents/mars_dev/mars/mars/utils.py in inner(*args, **kwargs)
471     def inner(*args, **kwargs):
472         with build_mode():
--> 473             return func(*args, **kwargs)
474     return inner
475

~/Documents/mars_dev/mars/mars/executor.py in execute_tileables(self, tileables, fetch, n_parallel, n_thread, print_progress, mock, compose)
817                 # build chunk graph, tile will be done during building
818                 chunk_graph = chunk_graph_builder.build(
--> 819                     tileables, tileable_graph=tileable_graph)
820                 tileable_graph = chunk_graph_builder.prev_tileable_graph
821                 temp_result_keys = set(result_keys)

~/Documents/mars_dev/mars/mars/utils.py in _wrapped(*args, **kwargs)
383                 _kernel_mode.eager = False
384             _kernel_mode.eager_count = enter_eager_count + 1
--> 385             return func(*args, **kwargs)
386         finally:
387             _kernel_mode.eager_count -= 1

~/Documents/mars_dev/mars/mars/utils.py in inner(*args, **kwargs)
471     def inner(*args, **kwargs):
472         with build_mode():
--> 473             return func(*args, **kwargs)
474     return inner
475

~/Documents/mars_dev/mars/mars/tiles.py in build(self, tileables, tileable_graph)
340
341         chunk_graph = super().build(
--> 342             tileables, tileable_graph=tileable_graph)
343         self._iterative_chunk_graphs.append(chunk_graph)
344         if len(self._interrupted_ops) == 0:

~/Documents/mars_dev/mars/mars/utils.py in _wrapped(*args, **kwargs)
383                 _kernel_mode.eager = False
384             _kernel_mode.eager_count = enter_eager_count + 1
--> 385             return func(*args, **kwargs)
386         finally:
387             _kernel_mode.eager_count -= 1

~/Documents/mars_dev/mars/mars/utils.py in inner(*args, **kwargs)
471     def inner(*args, **kwargs):
472         with build_mode():
--> 473             return func(*args, **kwargs)
474     return inner
475

~/Documents/mars_dev/mars/mars/tiles.py in build(self, tileables, tileable_graph)
253                     # for further execution
254                     partial_tiled_chunks = \
--> 255                         self._on_tile_failure(tileable_data.op, exc_info)
256                     if partial_tiled_chunks is not None and \
257                             len(partial_tiled_chunks) > 0:

~/Documents/mars_dev/mars/mars/tiles.py in inner(op, exc_info)
292                     on_tile_failure(op, exc_info)
293                 else:
--> 294                     raise exc_info[1].with_traceback(exc_info[2]) from None
295         return inner
296

~/Documents/mars_dev/mars/mars/tiles.py in build(self, tileables, tileable_graph)
233                 continue
234             try:
--> 235                 tiled = self._tile(tileable_data, tileable_graph)
236                 tiled_op.add(tileable_data.op)
237                 for t, td in zip(tileable_data.op.outputs, tiled):

~/Documents/mars_dev/mars/mars/tiles.py in _tile(self, tileable_data, tileable_graph)
328         if any(inp.op in self._interrupted_ops for inp in tileable_data.inputs):
329             raise TilesError('Tile fail due to failure of inputs')
--> 330         return super()._tile(tileable_data, tileable_graph)
331
332     @kernel_mode

~/Documents/mars_dev/mars/mars/tiles.py in _tile(self, tileable_data, tileable_graph)
191                 t._nsplits = o.nsplits
192         elif on_tile is None:
--> 193             tds[0]._inplace_tile()
194         else:
195             tds = on_tile(tileable_data.op.outputs, tds)

~/Documents/mars_dev/mars/mars/core.py in _inplace_tile(self)
160
161     def _inplace_tile(self):
--> 162         return handler.inplace_tile(self)
163
164     def __getattr__(self, attr):

~/Documents/mars_dev/mars/mars/tiles.py in inplace_tile(self, to_tile)
126         if not to_tile.is_coarse():
127             return to_tile
--> 128         dispatched = self.dispatch(to_tile.op)
129         self._assign_to([d.data for d in dispatched], to_tile.op.outputs)
130         return to_tile

~/Documents/mars_dev/mars/mars/utils.py in _wrapped(*args, **kwargs)
383                 _kernel_mode.eager = False
384             _kernel_mode.eager_count = enter_eager_count + 1
--> 385             return func(*args, **kwargs)
386         finally:
387             _kernel_mode.eager_count -= 1

~/Documents/mars_dev/mars/mars/tiles.py in dispatch(self, op)
113             return self._handlers[op_cls](op)
114         try:
--> 115             return op_cls.tile(op)
116         except NotImplementedError as ex:
117             cause = ex

~/Documents/mars_dev/mars/mars/dataframe/base/reset_index.py in tile(cls, op)
130     def tile(cls, op):
131         if isinstance(op.inputs[0], DATAFRAME_TYPE):
--> 132             return cls._tile_dataframe(op)
133         else:
134             return cls._tile_series(op)

~/Documents/mars_dev/mars/mars/dataframe/base/reset_index.py in _tile_dataframe(cls, op)
101         for c in in_df.chunks:
102             if is_range_index:
--> 103                 index_value = parse_index(pd.RangeIndex(cum_range[c.index[0]], cum_range[c.index[0] + 1]))
104             else:
105                 index_value = out_df.index_value

~/miniconda3/lib/python3.7/site-packages/pandas/core/indexes/range.py in __new__(cls, start, stop, step, dtype, copy, name)
102             start, stop = 0, start
103         else:
--> 104             stop = ensure_python_int(stop)
105
106         step = ensure_python_int(step) if step is not None else 1

~/miniconda3/lib/python3.7/site-packages/pandas/core/dtypes/common.py in ensure_python_int(value)
200         assert new_value == value
201     except (TypeError, ValueError, AssertionError):
--> 202         raise TypeError(msg.format(type(value), value))
203     return new_value
204

TypeError: Wrong type <class 'numpy.float64'> for value nan

# Fixed code
def _set_inputs(self, inputs):
    super()._set_inputs(inputs)
    if len(self._inputs) == 2:
        self._lhs = self._inputs[0]
        self._rhs = self._inputs[1]
    else:
        if isinstance(self._lhs, (DATAFRAME_TYPE, SERIES_TYPE)):
            self._lhs = self._inputs[0]
        elif pd.api.types.is_scalar(self._lhs):
            self._rhs = self._inputs[0]