match

Python pandas two table match to find latest date

Python pandas two table match to find latest date Question: I want to do some matching in pandas like Vlookup in Excel. According to some conditions in Table1, find the latest date in Table2: Table 1: Name Threshold1 Threshold2 A 9 8 B 14 13 Table 2: Date Name Value 1/1 A 10 1/2 A …

Total answers: 3

Grouping but the lists can contain duplicate elements

Grouping but the lists can contain duplicate elements Question: I have an ordered list L= [330.56, 330.6,330.65,330.7, …..] and I want to group it by a certain tolerance -+, but I can have duplicates, so I need to iterate over every element ( see if there are other elements within element-tol and element +tol) and …

Total answers: 1

python if list_item == re.match

python if list_item == re.match Question: I’m trying to practice regex patterns with conditions in python (googlecollab), but stuck in (if… and…) by getting proper numbers from the list[000 to 999] – i need only numbers, ending with one digit ‘1’ (not 11, 111, 211 – I need only 001, 021, 031, 101), but it …

Total answers: 1

Can I use list slicing on my match/case term in Python3

Can I use list slicing on my match/case term in Python3 Question: To elaborate I have a string x that will be in the structure of "Test_Case_Box 1" "Test_Case_Box 2" "Test_Case_Circle 1" I was using if and elif statements by checking for example if x[0:19] == "Test_Case_Box" With the match/case syntax if I set the …

Total answers: 1

How can I match a pattern, and then everything upto that pattern again? So, match all the words and acronyms in my below example

How can I match a pattern, and then everything upto that pattern again? So, match all the words and acronyms in my below example Question: Context I have the following paragraph: text = """ בביהכנ"ס – בבית הכנסת דו"ח – דין וחשבון הת"ד – התיקוני דיקנא בגו"ר – בגשמיות ורוחניות ה"א – ה’ אלוקיכם התמי’ …

Total answers: 3

Regex returns one big match instead of multiple matches

Regex returns one big match instead of multiple matches Question: I want to input :1: :2: and get back 2 separate matches. I used the regular expression :.+: However, regex sees this as one singular match. Regex returns :1: :2: instead of :1: :2: I am using the re library in Python Asked By: user13669275 …

Total answers: 2

Interaction between import, class and match…case in Python

Interaction between import, class and match…case in Python Question: I’m puzzled by how from … import …, class constructor and match…case in Python interact between each other. Given there are two modules, foo and bar. foo imports CONST from bar and tries to use it in Foo class __init__() within match…case construction. This gives UnboundLocalError. …

Total answers: 1

Replace multiple patterns once at a time with python

Replace multiple patterns once at a time with python Question: so what i wanna do is basically i have a list of urls with multiple parameters, such as: https://www.somesite.com/path/path2/path3?param1=value1&param2=value2 and i would want to get is something like this: https://www.somesite.com/path/path2/path3?param1=PAYLOAD&param2=value2 https://www.somesite.com/path/path2/path3?param1=value1&param2=PAYLOAD like i wanna iterate through every parameter (basically every match of "=" and "&") …

Total answers: 2