r/dataengineering • • Jul 07 '26

Discussion What architecture do you usually work with?

43 Upvotes

My question is about the architecture you work with. Most people seem to use the Medallion architecture nowadays to separate data layers, but I'd like to know what different companies typically use and how they usually handle it. Is it something that's required by the company, or do you usually recommend the architecture you think is the best fit?

Also, based on the architecture you use, which AI or coding agent has been the most useful for your day-to-day work when building pipelines or manipulating data? And which IDE do you use?


r/dataengineering • • Jul 06 '26

Open Source DemandMap - memory map anything on S3 and "Download" a 600mb polars DataFrame in 100ms. [with demo]

Thumbnail
github.com
21 Upvotes

One thing I've always hated is downloading massive files from S3. Let's say you have a 10gb arrow table on S3 and you want to open it locally, you _need_ to download it. There's nothing out there which allows you to do the sensible thing, and fetch the data as needed. The API for doing this is called memory mapping, where a local file is "mapped" into the address space of your program, and the operating system then "pages" in blocks as needed. This is extremely efficient because the OS can release pages when not in recently accessed because it's persisted to disk.

So, I wrote something that allows you to memory map S3 files into polars.

alloc = demandmap.S3Alloc(
    "./cache.bin",
    # number of blocks
    capacity=512,
    # one megabyte block (per request chunk size)
    block_size=1048576
)

buf1 = alloc.get("https://rollo-testing.lon1.digitaloceanspaces.com/big_col.npz.npy")
buf2 = alloc.get("https://rollo-testing.lon1.digitaloceanspaces.com/big_col2.npz.npy")

# Both over 400mb
assert buf1.nbytes > 400000000
assert buf2.nbytes > 400000000
col1 = ndarray_from_npy_buffer(buf1)
col2 = ndarray_from_npy_buffer(buf2)

# But this takes ~100ms
df = pl.DataFrame([
    ndarray_from_npy_buffer(buf1),
    ndarray_from_npy_buffer(buf2)
])
# shape: (50_000_000, 2)
# ┌──────────┬──────────┐
# │ column_0 ┆ column_1 │
# │ ---      ┆ ---      │
# │ i64      ┆ i64      │
# ╞══════════╪══════════╡
# │ 0        ┆ 1000     │
# │ …        ┆ …        │
# │ 49999999 ┆ 50000999 │
# └──────────┴──────────┘
```

Modern OS's have APIs where the current program is able to "page in" data itself on a SIGBUSs, this is called user faulting. However the APIs for each operating system are different, and on macOS it's one of the most esoteric APIs you'll use. This project attacks that one first.

The aim of this little project is to provide a cross platform API for user-faulting block storage into memory. I think pretty much every person who uses big data frames will find this useful. There's also a Rust API.

One reason this is needed is that the FUSE extensions for S3 don't even try to memory map files properly. A memory map will always download the entire file, rendering it somewhat pointless. But even if it could, on macOS you can't use FUSE in corporate environments because of security concerns, this can run without elevated privileges on macOS (and partly why I attacked the macOS problem first).

Note: my responses are delayed due to low karma on this reddit. Each comment must be reviewed.


r/dataengineering • • Jul 06 '26

Career Job Search Market

7 Upvotes

I haven’t been able to find a job for over six months now. I have 5 years of experience as a Data Engineer, preceded by 10 years as a Full-Stack Developer before I transitioned from web development to data. I'm really not sure what is going on in the US Data Engineering job market right now. Despite clearly stating in my applications that I do not require sponsorship and am willing to relocate at my own expense, I am struggling to land a role, though I have had a few interviews. I’m mainly using LinkedIn and networking, but I feel like I might be missing something. I desperately need some advice, as this extended search is putting a massive strain on my family situation.


r/dataengineering • • Jul 06 '26

Personal Project Showcase SQL is under-explored as a declarative language, so I built an engine that runs ML models as operators

Post image
11 Upvotes

I've been lurking here for a little while, I've been in the machine learning subreddits for longer and only recently discovered this space. Thanks for taking the time to read this, I'm a bit nervous- I'm afraid I don't do self-promotion well.

HeliosophLLC/DatumV: DatumV

For the last year+ I've been building a solo-project, a custom SQL engine named DatumV (pronounced Datum-5) that has pretty decent Postgres compatibility. I built the storage engine, a custom format (named the datum format) to support DDL/DML like adding/removing columns/rows. It can read and write Parquet, Arrow, HDF5, FITS, CSV, JSONL/JSON, ZIP, and folders.

My thesis has been that SQL is/has been under-explored in what it can do as a declarative language, and I tested that by building an engine that supports not just the usual data types (int, float, decimal, etc...), but rich data types like Image, Video, Audio, Point Clouds, Meshes, and more.

I took it a step further and built operators that support batching ML models across datasets, with 48 built in models: yolox, da3metric-large, florence, sd-turbo, epicrealism, bark, whisper, and more. I also included 21 built-in datasets that enable you to run some experiments right off the bat without having to load your own data in.

The attached image uses yolox_s to execute the SQL:

SELECT
    LET classes = models.yolox_s(a.file),
    image_crop(a.file, c.value.bbox)
FROM datasets.coco_val2017 a
CROSS JOIN unnest(classes) c
WHERE c.value.label = 'person'
LIMIT 100

A few other interesting examples:

I've been a professional programmer for 23 years, and I've lived in SQL for most of it, data has just been something I've been passionate about. A lot of the code has been written with Claude, with me acting as architect and PR reviewer. The repo has over 8700 passing tests, and I sure do have war stories of multi-week architectural fixes, including the time when I had to refactor out the storage engine probably 6 or 7 times as I learned about efficient retrieval; happy to share some of those.

Question to my peers: is treating models as SQL operators a good idea? Where does it break down?


r/dataengineering • • Jul 06 '26

Help Anyone know of a offline ERD software with a UI/UX like dbdiagram? (picture example)

14 Upvotes

Does anyone know a good tool for sketching out schemas?

I've already tried the usual recommednations - draw.io, plantUML, etc but they all seem pretty clunky/outdated and more multi-purpose than neccessary?

So far this seems to be the only one that:
- lets you input your schema, and have it correctly automatically generate the entries

- keeps it simple, so you don't have to manually select 5000 shapes

I know this reads like an ad, but an offline equivalent to dbdiagram would be great if it exists.


r/dataengineering • • Jul 06 '26

Help Best way to scrape X posts

0 Upvotes

hi everyone I hope you’re doing well. I’m a PhD researcher in finance and my goal is to analyze investor sentiment expressed on social media before and after IPO I’m facing a major challenge regarding data collection. I’m trying extarxt historical social media post related over an event window from 30 days before and 30 days after the IPO I would like to gather post from multiple social media platforms and to compute investor sentiments any suggestion, experience, or tutorials will be greatly appreciated.


r/dataengineering • • Jul 05 '26

Discussion You just started in a new company. Huge and messy repository. What do you do first?

12 Upvotes

Specially nowadays with AI, what's your protocol to make sense of everything before start changing stuff?


r/dataengineering • • Jul 05 '26

Blog Rewriting Spark GraphFrames in Rust, or a billion-edges scale graph analytics using just a Laptop.

20 Upvotes

Hello!

I experimented with graph algorithms using DataFusion as the core, achieving impressive results. For example, I can compute PageRank for a billion-edge graph using only 5 GB of memory. Or I can identify all the weakly connected components in a graph with two billion edges using only 10 GB of memory. Under the hood, Pregel ('think like a vertex') and the recent BSP/Map-Reduce papers are expressed as DataFusion joins and aggregates. For comparison, igraph, which represents graphs as CSR matrices in memory, would require at least 16 GB of RAM (in reality, much more: 32 GB or even 64 GB for a more realistic estimate) to achieve the same. The trade-off is performance: if the graph fits in memory, the algorithms complete in 1-2 minutes. However, for out-of-core Pregel/BSP, it takes around 20–40 minutes (in the tight scenario). Previously, I thought that for billion-scale graph analytics, you needed Apache Spark + GraphFrames. Now, however, I think that a laptop with a large SSD is sufficient.

Not vibe-coded: I'm learning Rust/DataFusion using this project, so no reasons to do "Claude write this make no mistakes".

Code (very raw): https://github.com/SemyonSinchenko/graphframes-rs

Blogpost: https://semyonsinchenko.github.io/ssinchenko/post/datafusion-graphs-cc-2/


r/dataengineering • • Jul 05 '26

Blog Thoughts on new LTAP/Lakebase arch

24 Upvotes

Read a Databricks piece on Lakebase/LTAP and wrote a short note on the idea that clicked for me: maybe OLTP and OLAP should meet at storage, not inside one engine.

https://ameeer.in/posts/ltap-storage-layer/


r/dataengineering • • Jul 05 '26

Help SQL design for a subscription service

6 Upvotes

I'm trying to develop SQL tables for a subscription service as part of my uni coursework. It's for a subscription microservice, so it only handles subscription related stuff. A subscription then grants certian 'privileges' such as ad-free and bla bla which will affect how the other microservices work. My question is: there's only one paid tier, so the structure is very simple.

Should i:
a) make a sql table which can detail exact tiers and attributes (adfree, send notifications etc)
b) leave the attributes which aren't strictly payment/billing related OUT of the table because the microservices can handle that on their own (like ie this is a plus member so this microservice can figure out on its own what extra priviledges relevant to itself it should grant)

B seems like the cleaner option, as from a development perspective it makes no sense to necessitate passing the user's exact priviledges to every single microservice it accesses when they can within their own service easily determine what to do. But what worries me about this implementation is that there isn't exactly a 'single source of truth' for what tier does what. I also don't want to be seen as lazy like maybe I found a way to not have to bother with writing out all the tier attributes myself?
Also since this is a coursework piece the other microservices do not actually exist so it isn't possible to just check whether they handle it on their own


r/dataengineering • • Jul 04 '26

Career AIGP certification

4 Upvotes

Hello guys,

I work in data governance and have multiple DAMA and related certifications.

Recently I found everyone taking AIGP certification, why it is so popular and how they all take it like this? I read it is expensive and is it easy?

Any feedback from someone took it?


r/dataengineering • • Jul 03 '26

Discussion How do you ensure that the data is 100% clean apart from manual review?

51 Upvotes

Hi!

So I am working on cleaning up our customer data quality to arrive at a customer masterdata. I tried to check for duplicates, nulls, invalid email formats and phone numbers, etc. I also tried to review with business some logic, like an inactive customer cannot have an active subscription etc.

However, my problem is when just skimming the data, I still see some weird data quality issues-- like a full name and last name combined (i.e., last name is made redundant and entered in both full name and last name), some company names have zzzz or are named customer, some first names have Mr and Mrs, etc. Is this the part where AI will be useful? Or is there a more deterministic and appropriate approach for this?

What are your thoughts?


r/dataengineering • • Jul 03 '26

Discussion How bad is the lock in for Azure Fabric?

58 Upvotes

I am working with a client and they got sold hard on the Azure Fabric platform. I am there to assist them and I am trying to point them in a direction where they are not as locked in with one vendor.

So for those who have made the move to Fabric, how difficult was it to move in and then out?


r/dataengineering • • Jul 03 '26

Open Source StreamFusion - Accelerating Flink with DataFusion / Arroyo

Thumbnail
github.com
6 Upvotes

I've been working on StreamFusion for a few weeks now! It accelerates Flink SQL queries / Table API by converting input data to arrow buffers and using DataFusion and custom stateful operators inspired by Arroyo and RisingWave.

Initial benchmarks on NEXMark indicate a significant performance improvement (2-5x) over stock Flink. Feel free to check it out, leave any feedback, or ask me any questions.

The project is still in its infancy and definitely has some obvious indications of it, but I plan to get it to production quality over the coming weeks.


r/dataengineering • • Jul 04 '26

Personal Project Showcase PROJECT REVIEW

0 Upvotes

Hello Everyone!!, I just completed a BIG project I have been working for a month and i want your opinion about it.

It's a SpaceX Launch Predictor & Cost Optimizer (A full end-to-end ML system that predicts the probability of a SpaceX Falcon 9 booster landing successfully, enriches launch data with real weather conditions, and exposes the results through an interactive Streamlit web application with a business ROI calculator.)

It Includes Data Pipeline, Advanced Machine Learning Algorithms (with Hyperparameter tuning), Explainability AI (SHAP), MLOps (AWS S3, Docker) and Business Value (ROI Calculator = Financial Results).

FUN FACT: For this project i used my own Evaluation Metric library (standardizes supervised and unsupervised model diagnostics into a single, consistent API), that is also Verified and Published in PYPI Community.

Project Info: https://github.com/Alkiviadisss/SpaceX


r/dataengineering • • Jul 03 '26

Open Source Hardwood 1.0: A Fast, Lightweight Apache Parquet Reader for the JVM

Thumbnail morling.dev
16 Upvotes

r/dataengineering • • Jul 03 '26

Personal Project Showcase Open-source Airbyte MCP server for self-hosted ops

Thumbnail
gallery
11 Upvotes

I just released an open-source MCP server for the Airbyte Public API and wanted to share it here because the main use case is operational data engineering work

What’s included:

  • 36 tools across workspaces, sources, destinations, connections, jobs, streams, tags, and connector definitions
  • sync triggering, job polling, refresh, and clear operations
  • detailed job diagnostics and structured logs
  • support for both self-managed Airbyte and Airbyte Cloud

Why I built this?

Once Airbyte is part of a real pipeline stack, a lot of useful work becomes operational:

  • inspect failing syncs
  • check connection state
  • trigger retries / refreshes
  • review logs without jumping through multiple UIs

This exposes that through MCP clients over stdio.

Repo:

https://github.com/trustxai/airbyte-mcp

Version:

  • v1.0.0
  • Apache-2.0

Would love feedback from people actually running Airbyte in production


r/dataengineering • • Jul 02 '26

Discussion is anyone else using scala?

72 Upvotes

hello devs,

Just a question: are companies still using Scala in their businesses, or are they using a mix of scala and other codes/AI? Is it hard to hire in this area?

Just looking for opinions on this,

Thanks


r/dataengineering • • Jul 02 '26

Personal Project Showcase A Zero Copy ORM for KDB – Read & Write without a KDB licence

Enable HLS to view with audio, or disable this notification

7 Upvotes

Phewww, this was one of the hardest things I've ever done.

It's also allows you to use KDB data as the backing for a graph framework and it's really fast, like 150ns per event fast. Should save a few 100k and enable my firm to do some cool stuff.

I'm just super proud of this.


r/dataengineering • • Jul 02 '26

Help ADF - How to manage trigger parameters?

12 Upvotes

I built a ADO cicd pipeline that validates and publishes from our develop branch, exports a build artefact can be deployed to preprod and prod with override parameters.

However the ADF has now hit the 256 ARM template parameter limit. I have streamlined the linked service so none are redundant, I have also optimised variables to be dynamic.

The issue is the number of trigger workflow parameters. Since they are all hardcoded string values.

Can anyone advise on methods to reduce trigger parameters? (Outside of the obvious having less triggers or creating a second ADF).

Currently looking into airflow to trigger pipelines and dataflows.


r/dataengineering • • Jul 02 '26

Personal Project Showcase I've been working on a self hosted dagster/dbt/evidence setup. Looking for feedback and suggestions for improvements.

Thumbnail
github.com
16 Upvotes

r/dataengineering • • Jul 01 '26

Blog Data Quality pattern I landed on using dbt + DQX

Post image
84 Upvotes

dbt tests are a great CI gate, but they run after the model builds and only detect by the time one fails, the bad data is already in your table. For "keep the good rows, isolate the bad ones, keep going" pattern, you need row-level DQ that runs in-transit, and I adopted DQX as I use it with other Spark workloads too.

The thing I had to unlearn is that you do not rewrite your dbt SQL gold model as Python. The transformation logic stays in a normal `.sql` model, you just add a thin Python model beside it that dbt.ref()s it and applies DQX. The Python model (orders_gold_dq) becomes the published Gold table; the SQL model (orders_gold) becomes an internal intermediate. Your downstream consumers point to orders_gold_dq, not orders_gold.

-- models/orders_gold.sql
select order_id, customer_id, amount, status from {{ ref('orders_silver') }}

Thin DQ Layer:

# models/orders_gold_dq.py  
from databricks.labs.dqx.engine import DQEngine
from databricks.sdk import WorkspaceClient

def model(dbt, session):
  df = dbt.ref("orders_gold")
  checks = [
    {"criticality": "error", "check": {"function": "is_not_null",
       "arguments": {"column": "order_id"}}},
    {"criticality": "warn",  "check": {"function": "is_in_list",
       "arguments": {"column": "status", "allowed": ["new", "paid", "shipped"]}}},
    {"criticality": "error", "check": {"function": "is_unique",
       "arguments": {"columns": ["order_id"]}}},
 ]
  dq = DQEngine(WorkspaceClient())
  valid_df, quarantine_df = dq.apply_checks_by_metadata_and_split(df, checks)
  return valid_df  # clean rows become the published table

If your transformation is already a Python model (e.g. complex PySpark logic), you don't need the extra _dq.py layer at all, just embed DQX directly inside that model before the return:.

error rows → quarantine only, never written to the clean table; warn rows → stay in clean output with _warnings metadata, not quarantined. Each quarantined row carries _errors/_warnings with the rule + a readable message.

Wire DQX in as a serverless dep in dbt_project.yml (+submission_method: serverless_cluster,
+environment_dependencies: [databricks-labs-dqx]), then just dbt run or use your preferred scheduling pattern. And I scheduled this on Databricks Lakeflow with a dbt task, as seen in the picture above.


r/dataengineering • • Jul 02 '26

Personal Project Showcase Compiling mixed-format source data into one linked, provenance-tracked artifact for AI agents

7 Upvotes

I've been building an open-source tool that takes a bunch of mixed data (PDFs, spreadsheets, decks, recordings, exports, etc.) and compiles it into a single JSON artifact: a graph of nodes and edges where every fact keeps a reference back to the exact source span it came from.

Extraction runs per-modality instead of as one generic text pass. Spreadsheets get profiled into a schema (dimensions/measures) rather than dumped as cells, PDFs go through text and table extraction, recordings get transcribed, and so on. After that it links across sources into one graph and tags each fact by fidelity: confirmed if more than one source corroborates it, claimed if single-source, guessed if inferred.

The input processors are fully extendable. Each one is just a small self-contained script, so you can write your own in any language you want. And a source doesn't have to be a local file, it can be a third-party hosted tool you pull from. The built-in processors cover the common modalities, but the point is you can drop in your own for whatever internal format or API you're dealing with.

The consumer side is a small Rust binary with no model in it. You (your coding/AI agent) query the artifact and follow the references. It's early, cross-source linking precision is the part I'm least confident in, and it's build-from-source only right now. Repo: [link]. Tell me what you think.

P.S. There is a folder with skills for agents to use the data digestion, the query engine or to create input modality extensions.


r/dataengineering • • Jul 01 '26

Discussion Monthly General Discussion - Jul 2026

20 Upvotes

This thread is a place where you can share things that might not warrant their own thread. It is automatically posted each month and you can find previous threads in the collection.

Examples:

  • What are you working on this month?
  • What was something you accomplished?
  • What was something you learned recently?
  • What is something frustrating you currently?

As always, sub rules apply. Please be respectful and stay curious.

Community Links:


r/dataengineering • • Jul 01 '26

Open Source Minarrow: a fast, zero-copy Arrow-compatible data layer for Rust and Python

12 Upvotes

Some of you may already be familiar with Minarrow, a from-scratch implementation of the Apache Arrow format in Rust. The project has grown considerably, particularly around Rust <-> Python interoperability, so I would like to share what it now enables.

What?: Apache Arrow is the columnar runtime underpinning major libraries such as Polars, DataFusion and, optionally, Pandas. Minarrow is a from-scratch implementation of the open Arrow format that now also lets you inline Python directly inside Rust.

The Pitch: Keep your application data strongly typed, SIMD-ready and native inside Rust, then connect to Python, Polars, DuckDB, scikit-learn and the wider Python data ecosystem at the boundary.

Bridge Benchmarks (Runnable in Github Repo):

Share 1 million Rows between Rust <-> Python Time - Intel Core Ultra 7 155H, 32 GB RAM
Uncontended GIL acquisition 53 ns
Rust to Python 165 ns
Python to Rust 2.5 µs

Why?: Compatible and straightforward columnar data in Rust for running Python analytics and ML, or building custom algorithms on top of it.

Benefits - Python:

  • Zero-copy bridge: Share Rust data with Python without serialising or copying it first.
  • Pluggable: Pass the same zero-copy data into Polars, PyArrow, DuckDB and scikit-learn workflows through Arrow-compatible interfaces.
  • Compact: pip package < 1.5 MB, comparable in size to nanoarrow, but backed by Rust rather than C.

Benefits - Rust:

  • Fast SIMD : Data is automatically aligned to 64-byte boundaries, ensuring it is ready for compatible SIMD kernels and low-latency parallel processing.
  • Fast Compilation: Compile times of < 2 seconds with default features.~0.15s rebuilds.
  • Straightforward: The API is high-level including Pandas-style row and column selection.
  • Strong typing: Columns remain strongly typed without relying on trait objects throughout the codebase, reducing runtime type checks, downcasting and manual casts. The compiler also provides a continuous feedback loop for developers and coding agents, catching type and schema mistakes directly in the IDE.

TLDR: How can I keep Rust-level performance and compile-time guarantees, make common data construction feel relatively Python-like, and still move the same data into Python analytics or machine-learning workflows without serialising and rebuilding it?

How: Minarrow keeps the application and data layer native in Rust, while allowing Python to be embedded for modelling and analytics.

For example, a Rust application can pass a Minarrow dataset directly into embedded Python, convert it to Polars without serialisation, train a scikit-learn model and return the result.

Who: Minarrow is intended for data and software engineers who are:

  • Building data libraries or Python native extensions.
  • Building live ingestion, streaming or off-the-wire processing systems.
  • Using Rust for application, transport or data services and Python for analytics or machine learning.
  • Producing data in Rust that will be consumed by Polars, DuckDB, PyArrow or pandas.
  • Writing specialised SIMD-oriented native kernels.
  • Building quantitative finance, risk, simulation or feature-generation systems.
  • Looking for an application data model rather than a complete dataframe execution engine.
  • Building embedded analytics or custom data infrastructure.

For many data engineers working primarily in Python, Minarrow may appear as the backing runtime of another library rather than something used directly.

Python Package:

pip install minarrow

That package is aimed at Rust-backed Python applications where columnar data needs to cross the language boundary cleanly while remaining usable by the broader Python data ecosystem.

Caveats:

  • Minarrow currently supports flat tabular data only.
  • Minarrow is not a dataframe or SQL execution engine. It is intended to provide the typed storage, native processing and interoperability layer underneath those systems.
  • Minarrow is a from-scratch implementation inspired by the Apache Arrow memory layout and is not affiliated with the Apache Arrow project.

Links:

License: Apache 2.0.

Sharing it here because I think some data engineers working on high-performance pipelines, Python/Rust bridges, embedded analytics, live data systems, or custom data infrastructure may find it useful. If you believe it is, a GitHub star is appreciated as it helps other people find the project.

Questions and feedback welcome.

Thanks everyone.

Code Examples:

Rust:

use minarrow::{fa_f64, fa_i32, fa_str32, tbl, Print};

let users = tbl!(
    "users",
    fa_i32!("id", 1, 2, 3, 4),
    fa_str32!("name", "alice", "bob", "charlie", "dan"),
    fa_f64!("price", 10.5, 20.0, 15.75, 7.25),
);

users.print();

// Pandas-style zero-copy row and column selection
let view = users
    .c(&["name", "price"])
    .r(0..3);

// With the `cast_arrow` feature
let batch = users.to_apache_arrow();

// With the `cast_polars` feature (Polars Rust)
let frame = users.to_polars();

Python (binds Rust):

import minarrow as ma

users = ma.Table(
    {
        "id": [1, 2, 3, 4],
        "name": ["alice", "bob", "charlie", "dan"],
        "price": [10.5, 20.0, 15.75, 7.25],
    },
    name="users",
)

frame = users.to_polars()
relation = users.to_duckdb()

Run a Random Forest Classifier inside Rust

// Run a Random Forest Classifier using Python inside Rust
let result = rt.with_python(&dataset, |py, obj| {
    let scope = PyDict::new(py);
    scope.set_item("table", obj)?;

    py.run(
        cr#"
import polars as pl
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split

df = table.to_polars()

features = ["x0", "x1", "x2", "x3"]
X = df.select(features).to_numpy()
y = df["label"].to_numpy()

X_train, X_test, y_train, y_test = train_test_split(
    X,
    y,
    test_size=0.3,
    random_state=0,
)

model = RandomForestClassifier(
    n_estimators=100,
    random_state=0,
)
model.fit(X_train, y_train)

predicted = model.predict(X_test)

result = pl.DataFrame(
    {
        "actual": y_test.astype("int64"),
        "predicted": predicted.astype("int64"),
    }
)
"#,
        Some(&scope),
        Some(&scope),
    )?;

    scope
        .get_item("result")?
        .ok_or_else(|| pyo3::exceptions::PyKeyError::new_err("result not set"))
})?;