Skip to content
Advertisement

Can I perform a left join/merge between two dataframes using regular expressions with pandas?

I am trying to perform a left merge using regular expressions in Python that can handle many-to-many relationships. Example:

JavaScript

Advertisement

Answer

You can use create a custom function to find all the matching indexes of both the data frames then extract those indexes and use pd.concat.

JavaScript

Timeit results

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement