Introducing krangl: A Powerful Data Wrangling Tool for Kotlin
In the ever-evolving world of data science and analysis, efficient data manipulation is key. As a product manager, it’s crucial to stay up to date with the latest tools and technologies to provide your team with the best resources available. One such tool is krangl, a Kotlin library for data wrangling that simplifies the process of filtering, transforming, aggregating, and reshaping tabular data.
Why krangl?
Krangl is designed to provide a modern, user-friendly, and easy-to-learn data science API. It draws inspiration from well-established data manipulation libraries like dplyr
for R and pandas
for Python. With krangl, you can leverage the power of Kotlin’s functional programming capabilities to streamline your data manipulation tasks.
The library offers a wide range of features, including:
- Reading data from various formats such as tsv, csv, and json
- Support for grouped operations
- Descriptive statistics calculations
- Table reshaping from wide to long and back
- Table joins and cross-tabulation
- Functional API inspired by
dplyr
,pandas
, and Kotlin’s standard library
Getting Started with krangl
To start using krangl, you can simply add it as a dependency to your build.gradle
file. The library is available on Maven Central, making the installation process straightforward. Once installed, you can access krangl’s functionality and leverage its features in your projects.
Examples
To give you a taste of what krangl can do, let’s look at a few examples of its usage:
-
Reading data from disk:
kotlin
val iris = DataFrame.readTSV("data/iris.txt") -
Creating a data frame in-memory:
kotlin
val df: DataFrame = dataFrameOf(
"first_name", "last_name", "age", "weight")(
"Max", "Doe", 23, 55,
"Franz", "Smith", 23, 88,
"Horst", "Keanes", 12, 82
) -
Adding columns with mutate:
kotlin
df.addColumn("salary_category") { 3 }
df.addColumn("age_3y_later") { it["age"] + 3 } -
Sorting data:
kotlin
df.sortedBy("age")
df.sortedBy("age", "weight") -
Filtering data:
kotlin
df.filter { it["age"] eq 23 }
df.filter { it["weight"] gt 50 } -
Summarizing data:
kotlin
df.summarize("mean_age" to { it["age"].mean(true) })
df.count("age", "last_name")
These are just a few examples of what you can accomplish with krangl. The library provides extensive functionality for data manipulation tasks, making it a valuable tool for any data scientist or analyst.
Documentation and Contribution
To learn more about krangl and its features, refer to the Krangl User Guide and the API Docs. These resources provide detailed information about the library’s API and usage examples.
If you’re interested in contributing to krangl, you can submit pull requests or open tickets for ideas, suggestions, or bug reports on the tracker. Your contributions and feedback are valuable in improving and maintaining the library.
In conclusion, krangl is a powerful data wrangling tool for Kotlin that simplifies the process of data manipulation and analysis. With its user-friendly API and extensive features, it’s a valuable asset for any data-focused project. So, give krangl a try and see how it can enhance your data wrangling workflow!
Please note that krangl is no longer actively developed and has been replaced by the more complete and modern Kotlin/dataframe. However, krangl still remains a useful resource for Kotlin-based data manipulation tasks.
Image source: None
Leave a Reply