Fahmatrix is a lightweight, modern Java library for working with tabular data β inspired by Pythonβs Pandas, but designed specifically for the JVM. Itβs early in development, but already offers a clean API for loading, exploring, and manipulating data with zero external dependencies.
Ideal for small projects, backend systems, or embedded environments like Android, Fahmatrix is built to bring structured data handling to every corner of the Java ecosystem.
π Intuitive API for tabular data
π Easy CSV, Xlsx, Ods, Json reading and previewing
π Easy CSV, Xlsx, Ods, Json writing
π Row filtering and column selection
π Column filtering by string operations (contains, equals, etc..)
π Aggregations (mean , average , etc.. )
π Grouping, and sorting (coming soon)
π§© No external dependencies (for now)
Visit Releases and download the latest JAR file.
Include it manually in your projectβs classpath
git clone https://github.com/moustafa-nasr/fahmatrix.git
cd fahmatrix
./gradlew build
Add to pom.xml
<dependency>
<groupId>com.fahmatrix</groupId>
<artifactId>fahmatrix</artifactId>
<version>0.1.6</version>
</dependency>
Add to build.gradle.kts
dependencies {
implementation("com.fahmatrix:fahmatrix:0.1.6")
}
Add to build.gradle
dependencies {
implementation 'com.fahmatrix:fahmatrix:0.1.6'
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.moustafa-nasr</groupId>
<artifactId>Fahmatrix</artifactId>
<version>v0.1.6</version>
</dependency>
For Java add to build.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.moustafa-nasr:Fahmatrix:v0.1.6'
}
For Kotlin add to build.gradle.kts
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
dependencies {
implementation("com.github.moustafa-nasr:Fahmatrix:v0.1.6")
}
import com.fahmatrix.DataFrame;
public class Main {
public static void main(String[] args) {
// read csv file
DataFrame df = DataFrame.readCSV("data.csv");
// pretty print data in system console
df.print();
// Pretty Print Data Summary in System Console
// count, min, max, sum, mean ,median, standard deviation, 25%, 50%, 70%
df.describe();
// select certain rows and colums
DataFrame result = df.select().rows(new int[]{1,2,3,5,6,8,110,10000,99}).columns(new String[]{"name","company","city"}).get();
// save the final data as JSON format
result.writeJson("output.json");
// save the final data as Microsoft Excel
result.writeXlsx("output.xlsx");
// save the final data as OpenDocument Spreadsheet
result.writeOds("output.ods");
// pretty print the last 3 rows
result.tail(3).print();
}
}
Library | Read Files | Aggregations | Notes |
---|---|---|---|
Fahmatrix | β | β | Pure Java |
Tablesaw | β | β | More dependencies |
Apache Arrow | β | β | Requires setup |
Pandas | β | β | Python-only |
You can find compiled Java Docs over here
- Load CSV, JSON, Microsoft Excel,Open office ODS files into DataFrame
- Save CSV, JSON, Microsoft Excel,Open office ODS files
- Pretty-print data to console
- View top rows with
head()
or bottom ones withtail()
- Tranculate Data
- Aggregations (count, min, max, sum, mean ,median, standard deviation, 25%, 50%, 70%, custom percentage)
- Filter data by String operations (contains, equal, equal ignore case, start with , end with, regex , not empty, custom String Predicate)
- Filter data by arithmetic operations (gt, lt, eq, neq)
- Filter data by Logic operations (and, or, not)
- GroupBy and pivot tables
- Nested JSON Data
- Data import/export for HTML, Xml, Parquet and more ..
- Type inference and conversion
- DSLInterpreter for SQL language lovers
Java has long lacked a clean, expressive DataFrame API β especially one that feels at home on the JVM.
Fahmatrix is an early-stage project that brings together data clarity (fahm) and structured thinking (matrix) to offer a lightweight, embeddable solution for tabular data processing in Java. Inspired by the elegance of tools like Pandas, Fahmatrix is built from the ground up to serve Java developers β whether you're building small utilities, backend services, or Android apps.
Itβs still early days, but the goal is clear: a fast, intuitive, dependency-free DataFrame library that works where Java works.
If you find Fahmatrix useful, consider sponsoring me to help support ongoing development, documentation, and future features.
MIT License. Use it freely in your projects.