Are you eager to handle your data with a modern approach using Kotlin? krangl is here to make data wrangling a breeze! Although krangl is no longer developed, it sets the groundwork to understand how data manipulation works in Kotlin, heavily inspired by R’s dplyr functionality. This blog post will guide you through the installation, features, examples, and some troubleshooting tips to enhance your experience with krangl.
Installation
Getting started with krangl is simple. Just follow these easy steps:
- Open your
build.gradlefile. - Add the following repository and dependency:
repositories {
mavenCentral()
}
dependencies {
implementation 'com.github.holgerbrandl:krangl:0.18.4'
}
Declaring the repository is optional since Maven Central is the default. Alternatively, if you want to use the latest snapshot, you can opt for JitPack:
repositories {
maven {
url 'https://jitpack.io'
}
}
dependencies {
implementation 'com.github.holgerbrandl:krangl:-SNAPSHOT'
}
To build and install to your local Maven cache, simply clone the repository and run bash ./gradlew install.
Features
krangl comes laden with features to make your data wrangling experience smooth and efficient:
- Filter, transform, aggregate, and reshape tabular data.
- User-friendly, modern API for data science.
- Supports reading from various formats: TSV, CSV, JSON, etc.
- Grouped operations and JDBC support.
- Columnar and row-based operations.
- Functional API inspired by dplyr, pandas, and Kotlin standard library.
Examples
To illustrate how krangl can be used, let’s explore a few examples.
1. Reading Data
You can read data from a file like this:
val iris = DataFrame.readTSV("data/iris.txt")
2. Creating a DataFrame
Creating a DataFrame in memory is a piece of cake:
val df: DataFrame = dataFrameOf("first_name", "last_name", "age", "weight")(
"Max", "Doe", 23, 55,
"Franz", "Smith", 23, 88,
"Horst", "Keanes", 12, 82
)
3. Manipulating Data
You can add columns, sort, filter, and summarize your DataFrames effortlessly:
val newDF = df.addColumn("full_name") { it["first_name"] + " " + it["last_name"] }
df.sortedBy("age")
Understanding the Data Wrangling Process with an Analogy
Imagine you’re a chef in a kitchen (your programming environment) trying to prepare a delicious meal (your dataset). Each ingredient (data point) is scattered on the counter (your database). krangl acts as your sous-chef, helping to:
- Chop and dice: Filtering and transforming your ingredients (data).
- Measure and mix: Aggregating (summarizing) quantities together.
- Rearrange: Reshaping your ingredients for a lovely presentation (formatting data for easy reading).
- Cook: Applying functions to see the results (running analyses).
Once everything is prepped and cooked, you get a beautiful dish (insight from your data). With krangl, you’ll feel like a master chef of data!
Documentation and Contribution
For more detailed information about krangl, check the Krangl User Guide and the API Docs. You can also contribute your ideas or report issues on the tracker.
Troubleshooting
If you encounter issues while using krangl, consider the following troubleshooting ideas:
- Check if you have correctly declared the repository in your build file.
- Verify that the required dependencies match your project structure.
- If you’re having trouble with data formats, ensure that the files are correctly formatted and accessible.
- Feel free to reach out via Gitter for community support.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

