Dataframe : replace value and values around based on condition

I would like to create a filter to replace values in a dataframe column based on a condition and also the values around it. For exemple I would like to filter values and replace then with NaN if they are superior to 45 but also the value before and after it even if they are… Read More Dataframe : replace value and values around based on condition

PowerShell: Replace underscores with either a period or @ sign

In PowerShell, I’m looking to convert a SharePoint Location string (john_smith_domain_com) to the proper addressing of john.Smith@domain.com. I’m not sure which is the best way to go about doing this. I know $var.Replace("_",".") would work to replace all the "_"s with "."s, but that doesn’t help the "@" going between the name and the domain.… Read More PowerShell: Replace underscores with either a period or @ sign

How to replace values in columns in DataFrame with staing coma if exists in Python Pandas?

I have Pandas DataFrame like below: df = pd.DataFrame() df["COL1"] = [111,222,333] df["COL2"] = ["CV_COUNT_ABC_XM_BF, CV_COUNT_DEF_XM_BF", "CV_COUNT_DEF_XM_ BF", "LACK"] df["COL3"] = ["LACK", "CV_COUNT_ABC_XM_BF, CV_COUNT_DEF_XM_BF", "CV_COUNT_DEF_XM_ BF xx"] df: COL1 | COL2 | COL3 ——-|——————————————|——— 111 | CV_COUNT_ABC_XM_BF, CV_COUNT_DEF_XM_BF | LACK 222 | CV_COUNT_DEF_XM_ BF | CV_COUNT_ABC_XM_BF, CV_COUNT_DEF_XM_BF 333 | LACK | CV_COUNT_DEF_XM_ BF xx …… Read More How to replace values in columns in DataFrame with staing coma if exists in Python Pandas?

How to use javascript replace without triggering the special replacement patterns?

I’m trying to inject some code into a file by using replace. The problem is if the target code contains any of the replace() function’s special character sequences, namely $$, it will do something different than what I expect, which is to just copy the characters exactly as they are. ‘replaceme’.replace(‘replaceme’, ‘$$’); you would think… Read More How to use javascript replace without triggering the special replacement patterns?

Multi-index tuple join

I have the following column of a multiple index tuple in this form: df_incumbent_Q.columns Which looks like this: MultiIndex([(‘Cust Linehaul’, ‘2022Q2’), (‘Cust Linehaul’, ‘2022Q3’), (‘Cust Linehaul’, ‘2022Q4’), ( ‘Load Number’, ‘2022Q2’), ( ‘Load Number’, ‘2022Q3’), ( ‘Load Number’, ‘2022Q4’)], names=[None, ‘Quarter’]) I am trying to combine the columns name so that I have something like… Read More Multi-index tuple join