Skip to content

Tag: optimization

How to Eliminate for loop in Pandas Dataframe in filling each row values of a column based on multiple if,elif statements

Trying to get rid of for loop to speedup the execution in filling values in Column ‘C’ based on if, elif conditions involving multiple columns and rows. Not able to find a proper solution. tried applying np.where with conditions, choices and default values. But failed to get expected results as i was unable to extract individual values from pandas series

Filter 2d list by another 2d list

I have a list A: A = [[‘512’, ‘102’] [‘410’, ‘105’] [‘820’, ‘520’]] And list B: B = [[‘510’, ‘490’, ‘512’, ‘912’] [‘512’, ‘108’, ‘102’, ‘520’ , ‘901’, ‘821’] [‘510’, ‘118’, ‘284’]] I would like to …