Skip to content

Tag: vector

How to Eliminate FOR Loop with the extraction of each value from

Unable to Extract correct values from Pandas Series to use in np.select Function as default value. # With For Loop: Getting Perfect values in column “C” [“No”,”No”,4,4,4,4,4,4] ”’ ”’ Answer You code is equivalent to: output: NB. If you want to keep the object type, use: df[‘C’] = df[‘B’].where(m1&m2).ffill().convert_dtypes().astype(object).fillna(df[‘C’])