TEAL is a financial performance calculator plugin for the RAVEN code, framework, resolving around the computation of Net Present Value and associated financial metrics.
Apache License 2.0
9
stars
21
forks
source link
[DEFECT] Indexing error in stacked CashFlow bar plot #83
I noticed an indexing error in the CashFlowPlot, specifically "Plot 1: Inflows, outflows and Net Cash Flow". In the stacked plot for the negative cash flows, the code is:
for i, _ in enumerate(cumCashFlow[0:negVar]):
if i == 0:
ax1.bar(dfYear['cfYears'], dfCashFlow.iloc[:,i], widthFlowbar, color = compColor[i],
label = labels.iloc[i,0], edgecolor='white')
else:
ax1.bar(dfYear['cfYears'], dfCashFlow.iloc[:,i], widthFlowbar, color = compColor[i],
bottom = dfCashFlow.iloc[:,0:i-1].sum(axis=1), label = labels.iloc[i,0], edgecolor='white')
If i=1 in the else portion, the bottom argument indexes the cash flow dataframe from 0:0 which does not take into account the i=0 cash flow. This results in a missing portion in the stacked bar plot.
What did you see instead?
Do you have a suggested fix for the development team?
The argument for bottom should be changed to bottom = dfCashFlow.iloc[:,0:i].sum(axis=1)
Describe how to Reproduce
Steps to reproduce the behavior:
Screenshots and Input Files
Please attach the input file(s) that generate this error. The simpler the input, the faster we can find the issue.
Platform (please complete the following information):
OS: [e.g. iOS]
Version: [e.g. 22]
Dependencies Installation: [CONDA or PIP]
For Change Control Board: Issue Review
This review should occur before any development is performed as a response to this issue.
[x] 1. Is it tagged with a type: defect or task?
[x] 2. Is it tagged with a priority: critical, normal or minor?
[x] 3. If it will impact requirements or requirements tests, is it tagged with requirements?
[x] 4. If it is a defect, can it cause wrong results for users? If so an email needs to be sent to the users.
[x] 5. Is a rationale provided? (Such as explaining why the improvement is needed or why current code is wrong.)
For Change Control Board: Issue Closure
This review should occur when the issue is imminently going to be closed.
[x] 1. If the issue is a defect, is the defect fixed?
[x] 2. If the issue is a defect, is the defect tested for in the regression test system? (If not explain why not.)
[x] 3. If the issue can impact users, has an email to the users group been written (the email should specify if the defect impacts stable or master)?
[x] 4. If the issue is a defect, does it impact the latest release branch? If yes, is there any issue tagged with release (create if needed)?
[x] 5. If the issue is being closed without a pull request, has an explanation of why it is being closed been provided?
Defect Description
Describe the defect
What did you expect to see happen?
I noticed an indexing error in the CashFlowPlot, specifically "Plot 1: Inflows, outflows and Net Cash Flow". In the stacked plot for the negative cash flows, the code is:
If
i=1
in theelse
portion, thebottom
argument indexes the cash flow dataframe from0:0
which does not take into account thei=0
cash flow. This results in a missing portion in the stacked bar plot.What did you see instead?
Do you have a suggested fix for the development team?
The argument for
bottom
should be changed tobottom = dfCashFlow.iloc[:,0:i].sum(axis=1)
Describe how to Reproduce Steps to reproduce the behavior:
Screenshots and Input Files Please attach the input file(s) that generate this error. The simpler the input, the faster we can find the issue.
Platform (please complete the following information):
For Change Control Board: Issue Review
This review should occur before any development is performed as a response to this issue.
For Change Control Board: Issue Closure
This review should occur when the issue is imminently going to be closed.