@Test public void testDataFrameToArray() { System.out.println("toArray"); double[][] output = df.select("age", "salary", "gender").toArray(false, CategoricalEncoder.ONE_HOT); assertEquals(4, output.length); assertEquals(4, output[0].length); assertEquals(48., output[0][0], 1E-10); assertEquals(23., output[1][0], 1E-10); assertEquals(13., output[2][0], 1E-10); assertEquals(48., output[3][0], 1E-10); assertEquals(230000., output[0][1], 1E-10); assertTrue(Double.isNaN(output[1][1])); assertTrue(Double.isNaN(output[2][1])); assertEquals(230000., output[3][1], 1E-10); assertEquals(0, output[0][2], 1E-10); assertEquals(1, output[1][2], 1E-10); assertEquals(0, output[2][2], 1E-10); assertEquals(0, output[3][2], 1E-10); assertEquals(1, output[0][3], 1E-10); assertEquals(0, output[1][3], 1E-10); assertEquals(1, output[2][3], 1E-10); assertEquals(1, output[3][3], 1E-10); }
@Override public DataFrame select(int... cols) { return new IndexDataFrame(df.select(cols), index); }
IndexDataFrame implements DataFrame { @Override public DataFrame select(int... cols) { return new IndexDataFrame(df.select(cols), index); } }
IndexDataFrame implements DataFrame { @Override public DataFrame select(int... cols) { return new IndexDataFrame(df.select(cols), index); } IndexDataFrame(DataFrame df, int[] index); }
IndexDataFrame implements DataFrame { @Override public DataFrame select(int... cols) { return new IndexDataFrame(df.select(cols), index); } IndexDataFrame(DataFrame df, int[] index); @Override StructType schema(); @Override String toString(); @Override Iterator<BaseVector> iterator(); @Override int columnIndex(String name); @Override int size(); @Override int ncols(); @Override Object get(int i, int j); @Override Stream<Tuple> stream(); @Override BaseVector column(int i); @Override Vector<T> vector(int i); @Override BooleanVector booleanVector(int i); @Override CharVector charVector(int i); @Override ByteVector byteVector(int i); @Override ShortVector shortVector(int i); @Override IntVector intVector(int i); @Override LongVector longVector(int i); @Override FloatVector floatVector(int i); @Override DoubleVector doubleVector(int i); @Override StringVector stringVector(int i); @Override DataFrame select(int... cols); @Override DataFrame drop(int... cols); @Override DataFrame merge(DataFrame... dataframes); @Override DataFrame merge(BaseVector... vectors); @Override DataFrame union(DataFrame... dataframes); @Override Tuple get(int i); }
IndexDataFrame implements DataFrame { @Override public DataFrame select(int... cols) { return new IndexDataFrame(df.select(cols), index); } IndexDataFrame(DataFrame df, int[] index); @Override StructType schema(); @Override String toString(); @Override Iterator<BaseVector> iterator(); @Override int columnIndex(String name); @Override int size(); @Override int ncols(); @Override Object get(int i, int j); @Override Stream<Tuple> stream(); @Override BaseVector column(int i); @Override Vector<T> vector(int i); @Override BooleanVector booleanVector(int i); @Override CharVector charVector(int i); @Override ByteVector byteVector(int i); @Override ShortVector shortVector(int i); @Override IntVector intVector(int i); @Override LongVector longVector(int i); @Override FloatVector floatVector(int i); @Override DoubleVector doubleVector(int i); @Override StringVector stringVector(int i); @Override DataFrame select(int... cols); @Override DataFrame drop(int... cols); @Override DataFrame merge(DataFrame... dataframes); @Override DataFrame merge(BaseVector... vectors); @Override DataFrame union(DataFrame... dataframes); @Override Tuple get(int i);  }