Ben Chuanlong Du's Blog

It is never too late to learn.

Hands on krangl in Kotlin

In [5]:
%classpath config resolver jcenter https://jcenter.bintray.com/
Added new repo: jcenter
In [6]:
%classpath add mvn de.mpicbg.scicomp krangl 0.11
In [12]:
import krangl.DataFrame
import krangl.dataFrameOf
Out[12]:
null

readCSV

In [40]:
DataFrame.readCSV("../../home/media/data/flights14.csv")
error: unresolved reference: readCSV
DataFrame.readCSV("../../home/media/data/flights14.csv")
          ^

dataFrameOf

In [14]:
val df: DataFrame = dataFrameOf(
    "first_name", "last_name", "age", "weight")(
    "Max", "Doe", 23, 55,
    "Franz", "Smith", 23, 88,
    "Horst", "Keanes", 12, 82
)
df
Out[14]:
A DataFrame: 3 x 4
    first_name   last_name   age   weight
1          Max         Doe    23       55
2        Franz       Smith    23       88
3        Horst      Keanes    12       82
In [38]:
df.javaClass.getMethods().forEach {
    println(it)
}
public krangl.DataFrame krangl.SimpleDataFrame.summarize(krangl.ColumnFormula[])
public krangl.DataFrame krangl.SimpleDataFrame.groupedBy()
public krangl.DataFrame krangl.SimpleDataFrame.ungroup()
public krangl.DataFrame krangl.SimpleDataFrame.filterByRow(kotlin.jvm.functions.Function2)
public krangl.DataFrame krangl.SimpleDataFrame.selectIf(kotlin.jvm.functions.Function1)
public krangl.DataFrame krangl.SimpleDataFrame.addColumns(krangl.ColumnFormula[])
public krangl.DataFrame krangl.SimpleDataFrame.transmute(krangl.ColumnFormula[])
public int krangl.SimpleDataFrame.getNrow()
public int krangl.SimpleDataFrame.getNcol()
public krangl.DataFrame krangl.SimpleDataFrame.addColumn(java.lang.String,kotlin.jvm.functions.Function2)
public krangl.DataFrame krangl.SimpleDataFrame.addColumn(krangl.ColumnFormula)
public java.util.List krangl.SimpleDataFrame.getCols()
public krangl.DataFrame krangl.SimpleDataFrame.sortedBy(java.lang.String[])
public krangl.DataFrame krangl.SimpleDataFrame.sortedByDescending(java.lang.String[])
public krangl.DataFrame krangl.SimpleDataFrame.groupBy(java.lang.String[])
public java.util.Map krangl.SimpleDataFrame.row(int)
public krangl.DataFrame krangl.SimpleDataFrame.select(kotlin.jvm.functions.Function1)
public krangl.DataFrame krangl.SimpleDataFrame.select(java.lang.Iterable)
public krangl.DataFrame krangl.SimpleDataFrame.select(kotlin.jvm.functions.Function1[])
public krangl.DataFrame krangl.SimpleDataFrame.select(java.lang.String[])
public java.lang.Iterable krangl.SimpleDataFrame.getRows()
public java.util.List krangl.SimpleDataFrame.getNames()
public krangl.DataFrame krangl.SimpleDataFrame.remove(java.lang.Iterable)
public krangl.DataFrame krangl.SimpleDataFrame.remove(kotlin.jvm.functions.Function1[])
public krangl.DataFrame krangl.SimpleDataFrame.remove(kotlin.jvm.functions.Function1)
public krangl.DataFrame krangl.SimpleDataFrame.remove(java.lang.String[])
public java.util.List krangl.SimpleDataFrame.groups()
public krangl.DataCol krangl.SimpleDataFrame.get(int)
public krangl.DataCol krangl.SimpleDataFrame.get(java.lang.String)
public boolean krangl.SimpleDataFrame.equals(java.lang.Object)
public java.lang.String krangl.SimpleDataFrame.toString()
public int krangl.SimpleDataFrame.hashCode()
public krangl.DataFrame krangl.SimpleDataFrame.removeIf(kotlin.jvm.functions.Function1)
public krangl.DataFrame krangl.SimpleDataFrame.filter(kotlin.jvm.functions.Function2)
public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
public final void java.lang.Object.wait() throws java.lang.InterruptedException
public final native java.lang.Class java.lang.Object.getClass()
public final native void java.lang.Object.notify()
public final native void java.lang.Object.notifyAll()
Out[38]:
null

Comments