h2o-3 icon indicating copy to clipboard operation
h2o-3 copied to clipboard

Python H2OFrame construction for Scipy sparse matrices ignores 'column_names' param

Open sebhrusen opened this issue 1 year ago • 0 comments

When importing a scipy sparse matrix to H2O using the H2OFrame constructor, the column_names param is ignored and columns are named using the default C1, C2, ... convention.

discovered when writing tests for https://github.com/h2oai/h2o-3/pull/15898 see test h2o-py/tests/testdir_apis/Data_Manipulation/pyunit_h2oH2OFrame.py

Current behaviour

In [11]: from scipy.sparse import csr_matrix, csc_matrix
    ...: h2o.H2OFrame(csr_matrix([[1, 0, 0],[0, 1, 0],[0, 0, 1]]), column_names=['x', 'y', 'z'])
Parse progress: |████████████████████████████████████████████████████████████████████████████████████ (done)| 100%
Out[11]:
  C1    C2    C3
----  ----  ----
   1     0     0
   0     1     0
   0     0     1
[3 rows x 3 columns]

Expected result

Out[11]:
   x     y     z
----  ----  ----
   1     0     0
   0     1     0
   0     0     1
[3 rows x 3 columns]

sebhrusen avatar Nov 22 '23 12:11 sebhrusen