multiple-conditions

Python Pandas ffill or bffill with multiple condition

Python Pandas ffill or bffill with multiple condition Question: I have a dataset like below : condition=[None,None,None,’condtion1′,None,None,None,’conditon2′,None,None,None] add_val = [None,None,None,10,None,None,None,20,None,None,None] df=pd.DataFrame({‘event_condition’:condition,’add_col’:add_val}) I want to fillna of add_col in terms of condition. When I meet condition 1 of event_condition, I want to ffill with value of 10 in a separate column called ‘on_condition1’. It should not …

Total answers: 1

Python Pandas Cumsum with reset everytime on multiple condition

Python Pandas Cumsum with reset everytime on multiple condition Question: I have a dataset like this : I want to make a two columns of cumulative sum of reference column. But I want to make it reset with two separate condition. For example, when I meet conditon 1, I want to reset just one column …

Total answers: 1

Multiple conditions for string variable

Multiple conditions for string variable Question: I am trying to add a new column "profile_type" to a dataframe "df_new" which contains the string "Decision Maker" if the "job_title" has any one of the following words: (Head or VP or COO or CEO or CMO or CLO or Chief or Partner or Founder or Owner or …

Total answers: 3

add suffix based on multiple conditions from string values in another column

add suffix based on multiple conditions from string values in another column Question: I would like to add a suffix to strings in one column when a condition is met in another column. If a value is present in "Market" column, "Symbol" column corresponding value is updated to include current ticker but I would like …

Total answers: 1