cardillo / joinery

Data frames for Java
https://joinery.sh
GNU General Public License v3.0
700 stars 166 forks source link

scala problem: df.add("colname", list) never gets used #66

Open benman1 opened 7 years ago

benman1 commented 7 years ago

Hi, I really like the interface and the possibilities of joinery. I am currently trying out different jvm tools for data manipulation and machine learning. I'd need a REPL for my purpose, and I am using scala, however, I am having some problems using joinery within scala as you can see below. Please help to make this work. Cheers! Ben.

java example (works fine):

List<Double> col1 = new ArrayList<Double>(Arrays.asList(1.0,2.0,3.0,4.0));
List<Double> col2 = new ArrayList<Double>(Arrays.asList(1.0,2.0,3.0,4.0));
DataFrame df = new DataFrame();
df.add("col1", col1);
df.add("col2", col2);
df.show(); // all fine!
System.out.println(df.columns()); // shows column names "col1" and "col2"

scala example (doesn't disambiguate between two methods):

val col1 : util.List[Double] = ArrayBuffer(1.0,2.0,3.0,4.0).asJava
val df = new DataFrame[Double]()
df.add("col1", col1)
//...

Error:(...) ambiguous reference to overloaded definition, both method add in class DataFrame of type (x$1: Any, x$2: java.util.List[Double])joinery.DataFrame[Double] and method add in class DataFrame of type (x$1: Object*)joinery.DataFrame[Double] match argument types (String,java.util.List[Double]) df.add("col1", col1)