Skip to content

Can’t get substring from strings. Help needed

I have a column that contains string like Expected Output: What I need is to get the substring (GDNDL380F4) after Name= to column Name and substring (FTT-87) after Type= to column Type. I tried different approaches with str.extract, find and re.find but for some reason I get wrong result (nan or an empty arra…

Removing specific word from WebElement text

Hello I am scraping a website using selenium which has a button named view profile whenever i scrape it shows me the text of button in my output because it’s under the same <div> that I am scraping data from like my code its ouput Is there any way I can remove that view profile text or stop it fro…

Taking the min value of N last days

I have this data frame: I want to show the min value of n last days (say, n = 4), using Date column, excluding the value of current day. A similar solution has provided by jezrael. (That one calculates the mean, and not min.) Expected result: Answer Use similar solution like @Chris with custom lambda function…

Coloring pivot table pandas dataframe

I have a pivot table created using pandas which looks like below: I want to apply color for the entire column based on account name starts with. Ex: If account name starts with “AA” color=yellow, if starts with “AB” then color = red How can I do that in python and save it into excel fi…

Pandas – merge multiple time columns and fill values

I have a dataframe (df): I need to merge the time columns, sort them, then fill the missing values in a “downwards” manner. The expected output is like so: Answer Use wide_to_long with some preprocessing – rename time column and convert index to column, then sorting by DataFrame.sort_values,…