Data frames for Java
joinery [joi-nuh-ree]
1. In woodworking, the craft of joining together
pieces of wood to produce more complex items.
2. In Java, a data analysis library for joining together
pieces of data to produce insight.Remember FizzBuzz (of course you do!), well imagine you have just
solved the puzzle (well done!) and you have written the results to
a comma-delimited file for further analysis. Now you want to know
how many times are the strings Fizz, Buzz, and FizzBuzz
printed out.
You could answer this question any number of ways, for example you
could modify the original program, or reach for Python/pandas, or even
(for the sadistic among us, you know who you are) type out a one-liner
at the command prompt (probably including cut, sort, and uniq).
Well, now you have one more option. This option is especially good if you are 1) using Java already and 2) may need to integrate your solution with other Java applications in the future.
You can answer this question with joinery.
df.groupBy("value")
.count()
.sortBy("-number")
.head(3)Printing out the resulting data frame gives us the following table.
value number
0 Fizz 27
1 Buzz 14
2 FizzBuzz 6See FizzBuzz.java for the complete code.
Get the executable jar and try it for yourself.
$ java -jar joinery-dataframe-1.10-jar-with-dependencies.jar shell
# Joinery -- Data frames for Java, 1.10-deb702e
# OpenJDK 64-Bit Server VM, Oracle Corporation, 1.8.0_92-internal
# Rhino 1.7 release 2 2009 03 22
> df = new DataFrame()
[empty data frame]
> df.add("value")
[empty data frame]
> [10, 20, 30].forEach(function(val) {
df.append([val])
})
> df
value
0 10
1 20
2 30
>Since version 1.10, joinery is included in the central repo. If you are upgrading from a prior version, note the new group id.
sh.joinery
joinery-dataframe
1.10
joinery includes some tools to make working with data frames easier.
These tools are available by running joinery.DataFrame as an application.
$ java joinery.DataFrame
usage: joinery.DataFrame [compare|plot|show|shell] [csv-file ...]Show displays the tabular data of a data frame in a gui window.
$ java joinery.DataFrame show data.csvPlot displays the numeric data of a data frame as a chart.
$ java joinery.DataFrame plot data.csvLaunches an interactive JavaScript shell for working with data frames.
…The complete api documentation for the DataFrame class is available
at https://joinery.sh
No open issues yet, or sync has not completed.