H2O python rbind error
Question: I have a 2000 rows data frame and I'm trying to slice the same data frame into
two and combine them together.

    
    
    t1 = test[:10, :]
    t2 = test[20:, :]
    temp = t1.rbind(t2)
    temp.show()
    

Then I got this error:

    
    
    ---------------------------------------------------------------------------
    EnvironmentError                          Traceback (most recent call last)
    <ipython-input-37-8daeb3375743> in <module>()
          2 t2 = test[20:, :]
          3 temp = t1.rbind(t2)
    ----> 4 temp.show()
          5 print len(temp)
          6 print len(test)
    
    /usr/local/lib/python2.7/dist-packages/h2o/frame.pyc in show(self, use_pandas)
        383       print("This H2OFrame has been removed.")
        384       return
    --> 385     if not self._ex._cache.is_valid(): self._frame()._ex._cache.fill()
        386     if H2ODisplay._in_ipy():
        387       import IPython.display
    
    /usr/local/lib/python2.7/dist-packages/h2o/frame.pyc in _frame(self, fill_cache)
        423 
        424   def _frame(self, fill_cache=False):
    --> 425     self._ex._eager_frame()
        426     if fill_cache:
        427       self._ex._cache.fill()
    
    /usr/local/lib/python2.7/dist-packages/h2o/expr.pyc in _eager_frame(self)
         67     if not self._cache.is_empty(): return self
         68     if self._cache._id is not None: return self  # Data already computed under ID, but not cached locally
    ---> 69     return self._eval_driver(True)
         70 
         71   def _eager_scalar(self):  # returns a scalar (or a list of scalars)
    
    /usr/local/lib/python2.7/dist-packages/h2o/expr.pyc in _eval_driver(self, top)
         81   def _eval_driver(self, top):
         82     exec_str = self._do_it(top)
    ---> 83     res = ExprNode.rapids(exec_str)
         84     if 'scalar' in res:
         85       if isinstance(res['scalar'], list): self._cache._data = [float(x) for x in res['scalar']]
    
    /usr/local/lib/python2.7/dist-packages/h2o/expr.pyc in rapids(expr)
        163       The JSON response (as a python dictionary) of the Rapids execution
        164     """
    --> 165     return H2OConnection.post_json("Rapids", ast=expr,session_id=H2OConnection.session_id(), _rest_version=99)
        166 
        167 class ASTId:
    
    /usr/local/lib/python2.7/dist-packages/h2o/connection.pyc in post_json(url_suffix, file_upload_info, **kwargs)
        515     if __H2OCONN__ is None:
        516       raise ValueError("No h2o connection. Did you run `h2o.init()` ?")
    --> 517     return __H2OCONN__._rest_json(url_suffix, "POST", file_upload_info, **kwargs)
        518 
        519   def _rest_json(self, url_suffix, method, file_upload_info, **kwargs):
    
    /usr/local/lib/python2.7/dist-packages/h2o/connection.pyc in _rest_json(self, url_suffix, method, file_upload_info, **kwargs)
        518 
        519   def _rest_json(self, url_suffix, method, file_upload_info, **kwargs):
    --> 520     raw_txt = self._do_raw_rest(url_suffix, method, file_upload_info, **kwargs)
        521     return self._process_tables(raw_txt.json())
        522 
    
    /usr/local/lib/python2.7/dist-packages/h2o/connection.pyc in _do_raw_rest(self, url_suffix, method, file_upload_info, **kwargs)
        592       raise EnvironmentError(("h2o-py got an unexpected HTTP status code:\n {} {} (method = {}; url = {}). \n"+ \
        593                               "detailed error messages: {}")
    --> 594                               .format(http_result.status_code,http_result.reason,method,url,detailed_error_msgs))
        595 
        596 
    
    EnvironmentError: h2o-py got an unexpected HTTP status code:
    500 Server Error (method = POST; url = http://localhost:54321/99/Rapids). 
    detailed error messages: []
    

If I count rows (len(temp)), it works find. Also if I change the slicing index
a little bit, it works find too. For example, if I change to this, it shows
the data frame.

    
    
    t1 = test[:10, :]
    t2 = test[:5,  :]
    

Do I miss something here? Thanks.


Answer: Unclear what happened without more information (logs would probably say why
the rbind did not take).

What version are you using? I tried your code with iris on the bleeding edge
and it all worked as expected.

By the way, rbind is typically going to be expensive, especially since what
you're semantically after is a subset:

`test[range(10) + range(20,test.nrow),:]`

should also give you the desired subset (with caveat that you make the full
list of row indices in python and pass it over REST to h2o).

