# Buggy code
def describe_builder(df, **kwargs):
    return pandas.DataFrame.describe(df, **kwargs)


# Traceback (RayTaskError)
---------------------------------------------------------------------------
RayTaskError                              Traceback (most recent call last)
~/Downloads/kaggle5/kaggle5.py in <module>
51
52
---> 53 train_df.describe(include=['O'])
54
55 # In[9]:

~/software_builds/modin/modin/pandas/dataframe.py in describe(self, percentiles, include, exclude)
1093         return DataFrame(
1094             query_compiler=self._query_compiler.describe(
-> 1095                 percentiles=percentiles, include=include, exclude=exclude
1096             )
1097         )

~/software_builds/modin/modin/data_management/query_compiler/pandas_query_compiler.py in describe(self, **kwargs)
1601             func, 0, new_columns, False
1602         )
-> 1603         new_index = self.compute_index(0, new_data, False)
1604         if numeric:
1605             new_dtypes = pandas.Series(

~/software_builds/modin/modin/data_management/query_compiler/pandas_query_compiler.py in compute_index(self, axis, data_object, compute_diff)
136             axis=axis,
137             index_func=lambda df: pandas_index_extraction(df, axis),
--> 138             old_blocks=old_blocks,
139         )
140         return index_obj[new_indices] if compute_diff else new_indices

~/software_builds/modin/modin/engines/base/block_partitions.py in get_indices(self, axis, index_func, old_blocks)
514             new_indices = (
515                 [idx.apply(func).get() for idx in self._partitions_cache.T[0]]
--> 516                 if len(self._partitions_cache.T)
517                 else []
518             )

~/software_builds/modin/modin/engines/base/block_partitions.py in <listcomp>(.0)
513             # DO NOT CHANGE TO self.partitions under any circumstance.
514             new_indices = (
--> 515                 [idx.apply(func).get() for idx in self._partitions_cache.T[0]]
516                 if len(self._partitions_cache.T)
517                 else []

~/software_builds/modin/modin/engines/ray/pandas_on_ray/remote_partition.py in get(self)
26             return self.apply(lambda x: x).get()
27
---> 28         return ray.get(self.oid)
29
30     def apply(self, func, **kwargs):

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ray/worker.py in get(object_ids, worker)
2384                 # here.
2385                 last_task_error_raise_time = time.time()
-> 2386                 raise value
2387             return value
2388

RayTaskError: ray_worker:modin.engines.ray.pandas_on_ray.remote_partition.deploy_ray_func() (pid=17711, host=iMac.local)
ray.worker.RayTaskError: ray_worker:modin.engines.ray.pandas_on_ray.axis_partition.deploy_ray_axis_func() (pid=17712, host=iMac.local)
File "/Users/DevinPetersohn/software_builds/modin/modin/engines/ray/pandas_on_ray/axis_partition.py", line 127, in deploy_ray_axis_func
result = func(dataframe, **kwargs)
File "/Users/DevinPetersohn/software_builds/modin/modin/data_management/query_compiler/pandas_query_compiler.py", line 163, in helper
return pandas_func(df, **kwargs)
File "/Users/DevinPetersohn/software_builds/modin/modin/data_management/query_compiler/pandas_query_compiler.py", line 1596, in describe_builder
return pandas.DataFrame.describe(df, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/generic.py", line 8585, in describe
d = pd.concat(ldesc, join_axes=pd.Index([names]), axis=1)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/reshape/concat.py", line 225, in concat
copy=copy, sort=sort)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/reshape/concat.py", line 259, in __init__
raise ValueError('No objects to concatenate')
ValueError: No objects to concatenate

# Fixed code
def describe_builder(df, **kwargs):
    try:
        return pandas.DataFrame.describe(df, **kwargs)
    except ValueError:
        return pandas.DataFrame(index=df.index)