substring

How to filter for substring in list comprehension in python

How to filter for substring in list comprehension in python Question: I have a dictionary of dataframes. I want to create a list of the names of all of the dataframes in this dictionary that have the substring "blue" in them. No dataframes in the dictionary of dataframes contain a column simply called "blue". It …

Total answers: 1

Pandas: Create new column with substring from other column

Pandas: Create new column with substring from other column Question: I have various columns which contains values like this: FSA: 123.45 US DOLLAR FSA: 67.89 JAPANESE YEN I would like to create a new column that contains this: 123.45 67.89 The ‘FSA: ‘ is a constant value, but the currency type and amount will vary. …

Total answers: 1

Regular expression in Pandas: Get substring between a space and a colon

Regular expression in Pandas: Get substring between a space and a colon Question: I have a Pandas dataframe with the column store. It contains a list of stores that look like this: H-E-B 721:1101 W STAN SCHLUETER LOOP,KILLEEN,TX H-E-B PLUS 39:2509 N MAIN ST,BELTON,TX I want the store number, which are 721 and 39 in …

Total answers: 4

How do I rotate a string to the right until every letter has been rotated?

How do I rotate a string to the right until every letter has been rotated? Question: I want to rotate a word to the right, so that every letter has passed. What I tried to do is make a function. It looks like this (yeah yeah ik lmao): word = "Abobus"; length = len(word); n …

Total answers: 4

Find if a string contains substring with a number, some distance from another substring

Find if a string contains substring with a number, some distance from another substring Question: I have a string like s = ‘ahlkhsa-anchorawO&B6o77ooiynlhwlkfnbla,)9;}[test:""ajanchorkh,2Yio98vacpoi [p{7}]test:"2"*iuyanchorap07A(p)a test:""*^g8p9JiguanchorLI;ntest:"9.3"’ i’d like to see if there exists a substring test:"some_number_here" that’s at most 5 characters following anchor So in this case there is, test:"9.3" is following substring anchor after 5 …

Total answers: 1

Check if a substring is in a string python

Check if a substring is in a string python Question: I have two dataframe, I need to check contain substring from first df in each string in second df and get a list of words that are included in the second df First df(word): word apples dog cat cheese Second df(sentence): sentence apples grow on …

Total answers: 1

How to merge common strings with different values between parenthesis in Python

How to merge common strings with different values between parenthesis in Python Question: I am processing some strings within lists that look like these: [‘COLOR INCLUDES (40)’, ‘LONG_DESCRIPTION CONTAINS ("BLACK")’, ‘COLOR INCLUDES (38)’] [‘COLOR INCLUDES (30,31,32,33,56,74,84,85,93,99,184,800,823,830,833,838,839)’, ‘COLOR INCLUDES (30,31,32,33,56,74,84,85,93,99,184,409,800,823,830,833,838,839)’, ‘COLOR INCLUDES (800)’] Thing is, I want to merge similar strings with their values into one, …

Total answers: 1

Python Substring Regex Extraction

Python Substring Regex Extraction Question: I have the following types of strings: FWI20010112 DC20030405 etc… I need to extract segments of the strings into separate variables like this (example): name: FWI year: 2001 month: 01 day: 12 So, the name segment of the string can vary between 2 or 3 characters, and the following digits …

Total answers: 1