Relative Content

Tag Archive for pythonpandasregex

Converting python’s regular expression that works only with contains to work in match:

I’m a bit confused about how regular expressions work with python methods. In particular, there’s an exercise from leetcode (https://leetcode.com/problems/patients-with-a-condition/description/) that is in which we have to find in the word DIAB1 exists in the string. Seems easy, right? However, I can’t seem to get the correct regular expression to fit the str.match() method. I ended using one of the posted solutions which uses str.contains() instead of str.match() but I’d like to get the full regular expression correct.

How to use replace text using a regex in a Pandas dataframe [duplicate]

This question already has answers here: replace() method not working on Pandas DataFrame (10 answers) Closed 37 secs ago. I have the following dataset: meste = pd.DataFrame({‘a’:[’06/33′,’40/2′,’05/22′]}) a 0 06/33 1 40/2 2 05/22 And I want to remove the leading 0s in the text (06/33 to 6/33 for example). I tried this, without success: […]

Checking values row per row to assign proper work center to product

I am tasked with matching the products from a table to the Work Center they are supposed to be sent to. To do this, I have 2 tables: one contains the details about what product goes to what Work Center, and one containing the informations about the product to be made.