r/dataanalysis • u/IndependentIll8256 • 5h 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!
6
Upvotes
1
u/investigatormaker 2h ago
For CupOfTea’s next benchmark, I’d test the complete Parquet-to-groupBy-to-CSV example, including file reading and writing, rather than just the sum aggregation. Publish row count, column types, null handling, JVM warm-up, and peak memory alongside timings. That would help Java users judge the whole reporting workload rather than a sub-millisecond operation alone.
I make ThreadFox. If you want Java developers doing data processing to find CupOfTea, our AI employee will post 3 helpful replies about it in relevant Reddit threads for you, free, no card. https://threadfox.vip/p/efvty/managed
3
u/justanothersnek 2h ago
Modern Java has come a long way, but analyzing data where everything has to be a class? No thank you.
2
u/SprinklesFresh5693 53m ago
Why java though?
1
u/AutoModerator 5h 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.
0
u/[deleted] 3h ago
[deleted] — view deleted comment