Member-only story

merge your datasets like a boss

Sirine Amrane
5 min read4 days ago

--

heeeeey data folks ! if you’ve ever worked with data tables, you’ve probably encountered the dreaded not allowed to merge between different levels >:)” error. frustrating, right? don’t worry, you’re in the right place. let’s dive right.

in data science, ml and dl we often work with large datasets, and one common problem arises when trying to merge (combine) two DataFrames that do not share the same index structure. this leads to the dreaded “not allowed to merge between different levels” error.

bad dataset joins can cause catastrophic model drift, incorrect pnl estimates, and unreliable signals.

to properly understand what’s happening and how to resolve it, we first need to clarify a few fundamental concepts

some definitions :

  • dataframe : a dataframe is a two-dimensional tabular data structure commonly used in data analysis and manipulation. it can be thought of as a table with labeled rows and columns, where each column can contain a different type of data (ex : integers, floats, strings). dataframes offer easy indexing, slicing, and a rich set of functions for exploring, transforming, and joining data
  • index: in pandas, the index is the column (or set of columns) that allows one to identify each row uniquely or almost uniquely. by default, it is the…

--

--

Sirine Amrane
Sirine Amrane

No responses yet