r/dataanalysis • u/IndependentIll8256 • 21d ago
Data Tools Have you ever used Java for data analysis? I'm building CupOfTea, a fast, Pandas-like DataFrame library.
Sum Aggregation
Tablesaw : ■■■■■■■■■■ 0.48 ms
DFLib : ■■■■■■■■■ 0.42 ms
Pandas : ■■■■■■■ 0.35 ms
Polars : ■■ 0.08 ms
CupOfTea : ■ 0.05 ms (9.6x faster than Tablesaw, 1.6x faster than Polars)Here is a quick example reading from a Parquet file, aggregating by department, and exporting to CSV:
package com.example;
import com.cupoftea.CupOfTea;
import static com.cupoftea.aggregate.Aggregations.*;
public class ParquetToCsvReportExample {
public static void main(String[] args) {
String inputParquet = "sales.parquet";
String outputCsv = "sales_summary_report.csv";
CupOfTea df = CupOfTea.read().parquet(inputParquet);
CupOfTea report = df.groupBy("department")
.agg(
sum("total_amount").as("total_revenue"),
mean("total_amount").as("average_ticket"),
count("order_id").as("order_count")
);
report.write().csv(outputCsv);
}
}The project is open source: https://github.com/cupoftea-labs/cupoftea
I’d love to hear your thoughts:
- What features or pain points make you reach for Python instead of doing data processing natively in Java?
- Any specific workloads or benchmarks you’d like to see tested next?
All feedback, issues, and critique are welcome!
8
Upvotes
4
u/SprinklesFresh5693 21d ago
Why java though?
2
u/virgilash 21d ago
Check duckdb against same data, op :-)
2
u/Aeronautical-You4917 20d ago
If this is a personal project, great! If this is something you want to use at work, etc. Just use DuckDB. Trust me.
3
u/justanothersnek 21d ago
Modern Java has come a long way, but analyzing data where everything has to be a class? No thank you.
1
u/AutoModerator 21d ago
Automod prevents all posts from being displayed until moderators have reviewed them. Do not delete your post or there will be nothing for the mods to review. Mods selectively choose what is permitted to be posted in r/DataAnalysis.
If your post involves Career-focused questions, including resume reviews, how to learn DA and how to get into a DA job, then the post does not belong here, but instead belongs in our sister-subreddit, r/DataAnalysisCareers.
Have you read the rules?
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/No_Flounder_1155 20d ago
ai slop
0
u/[deleted] 21d ago
[deleted] — view deleted comment
1
u/[deleted] 21d ago
[removed] — view removed comment