0

I have a Panadas dataframe which encompasses 4 columns (company, price today, cash flow y1, cash flow y2, cash flow y3 (i.e. a terminal value)):

Code Price 0 1 2
GOOGL-US -2380 0 0 4074.94
AMZN-US -3265 0 0 5765.09
FB-US -327 0 0 513.819

etc for ~100 tickers

Is there a way to do a simple IRR calc using the data from the columns price, 0, 1, 2 as at annual periods (i.e. t0, t1, t2, t3)?

Thank you!

Anurag Dabas
  • 23,866
  • 9
  • 21
  • 41
Teddy P
  • 1
  • 1

1 Answers1

0

I don't have concrete solution but could give you some hint and direction to look for. There had been a Numpy function Numpy.irr() supporting IRR calculation in Numpy / Pandas. However, it had been deprecated since Numpy version 1.18 and moved to separate module at NumPy Financial where you can still install it e.g. by:

pip install numpy-financial

Then use it as, e.g.

import numpy_financial as npf

npf.irr([-250000, 100000, 150000, 200000, 250000, 300000])
0.5672303344358536

You can refer to this article Calculating IRR in Python for some usage examples.

SeaBean
  • 22,547
  • 3
  • 13
  • 25
  • Yh. The issue I'm having is scaling that framework to calculate it for every ticker in the dataframe – Teddy P May 28 '21 at 17:47