Aug-20-2019, 11:35 PM
When you are working with Pandas, it is important to think in vectorized form. Don't use loops, you can operate with entire dataframe columns. Express what you are trying to do. I don't know what "fv, cp_rate, maturity_year, coupon_per_year" variables are. Are they assumed to be columns of a dataframe? If so, you can likely rewrite your function in fully vectorized form.