Calculate Rate of Return for a table shown below using excel - excel

This is a simple math question that i will be using excel formula for. I have 5 columns. broken up like this
Total Rentals| Out | New rented|Returned|Available|rate of retun
200 40 40 0 160
200 60 20 0 140 x
200 90 30 4 114 x
200 150 60 20 70 x
How do i find the rate of return?

Related

winsorize does not affect the outlier

I have this set of data in a DataFrame :
data
winsor_data
0
1660
1660
1
600
600
2
50
50
3
3173.55
3173.55
4
30
30
5
120
120
6
7.84
7.84
7
1660
1660
8
33.3
33.3
9
2069.49
2069.49
10
42
42
11
384.29
384.29
12
1660
1660
13
1338.57
1338.57
14
200000
200000
15
1760
1760
The 14th value is clearly an outlier.
from scipy.stats.mstats import winsorize
dfdailyIncome['winsor_data'] = winsorize(df['data'], limits=(0,0.95))
I do not understand why the outlier is not clipped. May be it has something to do with the way the quantiles are calculated.
I think you are misinterpreting the 'limits' parameter.
If you want to cut 10 percent of your largest values, you need:
dfdailyIncome['winsor_data'] = winsorize(df['data'], limits=[0,0.1])
You cut 95 percent of your largest data in your example.
Hint: Even if you would use winsorize(df['data'], limits=[0,0.05]), your data would stay the same because 5 percent of your largest data is the original data because you have less than 20 values.
See the example from here for further explanation: scipy.stats.mstats.winsorize

How do I create series in Excel using criteria from values in other cells?

I have an Excel spreadsheet populated as below:
Latitude
Longitude
Altitude
Value
10
10
1
100
10
10
5
105
10
10
20
120
10
5
1
150
10
5
5
155
10
5
20
170
15
10
1
500
15
10
5
505
15
10
20
520
15
5
1
550
15
5
5
555
15
5
20
570
Using this data, I would like to create a Chart in Excel where I have Value on the X-axis, Altitude on the Y-Axis and a series for each unique combination of Latitude and Longitude.
This should result in 4 series being plotted on the Chart with each series having 3 values (one value for each Altitude. I feel like this should be easy to do but I'm struggling to do it myself or find something using the grand-old Google.
Any help you could provide this Excel-noob would be greatly appreciated!
If you re-arrange your data like that
value
altitude
value
altitude
value
altitude
value
altitude
long-lat:
10-10
10-5
15-10
15-5
100
1
150
1
500
1
550
1
105
5
155
5
505
5
555
5
120
20
170
20
520
20
570
20
you can insert the four curves individually into a "points (x/y)" diagram:
Here is a screenshot of how the curves are defined:

How to sum certain columns ending a certain word of a dataframe in python pandas?

I am trying to get 'summing' of columns ending 'Load' and 'Gen' to two new columns.
My dataframe is:
Date A_Gen A_Load B_Gen B_Load
1-1-2010 30 20 40 30
1-2-2010 45 25 35 25
The result wanted is:
Date A_Gen A_Load B_Gen B_Load S_Gen S_Load
1-1-2010 30 20 40 30 70 50
1-2-2010 45 25 35 25 80 50
Try using filter(like='..') to get the relevant columns, sum along axis=1, and return your 2 new columns:
df['S_Gen'] , df['B_Load'] = df.filter(like='Load').sum(1) , df.filter(like='Gen').sum(1)
Output:
df
Out[146]:
Date A_Gen A_Load B_Gen B_Load S_Gen
0 2010-01-01 30 20 40 70 50
1 2010-02-01 45 25 35 80 50

Average formula using number of blank rows above

I'm working on spreadsheet with logged flows that are not at uniform periods.
Looking for formula for Col G that will average values in Col A for logged values for previous 10 minutes.
Here's the spreadsheet data:
Flow Time min sec sec 10_min Average
187.29 06:10:09 10 9 609
202.90 06:11:21 11 21 681
280.94 06:12:37 12 37 757
218.51 06:13:43 13 43 823
187.29 06:15:13 15 13 913
124.86 06:16:26 16 26 986
109.25 06:18:52 18 52 1132
109.25 06:20:00 20 0 1200 1 177.54
202.90 06:22:30 22 30 1350
265.33 06:23:36 23 36 1416
280.94 06:24:42 24 42 1482
249.73 06:25:58 25 58 1558
218.51 06:27:39 27 39 1659
421.41 06:28:47 28 47 1727
421.41 06:30:00 30 0 1800 1 294.32
Use an AVERAGEIFS and construct the criteria with the TEXT function while modifying one criteria by ten minutes.
=AVERAGEIFS(A:A,B:B, TEXT(B9-TIME(0, 10, 0), "\>0.0###############"),B:B, TEXT(B9, "\<\=0.0###############"))
Note that times can also be resolved as decimal numbers which I have used here. My second average came up slightly different from yours. You may wish to change the \>\= to \> .

Python 3.5 returning unexpected answer

I am getting an unexpected outcome in python. The output should be 440, but I get 370 so I am missing something in my loop I think.
The code is calculating fixed payments to pay off a balance (b) taking into account interest (mir) and increasing payment (mp) by 10 each loop if the balance isn't paid off.
My current code is
b = 4773
air = 0.2
mir = air/12.0
m = 1
mp = 10
while m in range(0,12):
ub = b - mp
b = ub + (mir * ub)
cb = b
m += 1
if cb> 0:
mp += 10
m = 0
print(str(mp))
I am not looking for so much a code fix, but an explanation of where I am going wrong and what I should look at to fix it. I can see the code running and it loops fine I am just ending up with an unexpected answer so I am missing something. I am trying to learn python and that would help me more than just a fix :)
You wrote in the comments:
The formula is calculating fixed payments to pay off a balance taking into account interest and increasing payment by 10 each loop if the balance isn't paid off.
I would do the following. (I tried to give your variables descriptive names.)
balance = 4773
annual_interest_rate = 0.2
monthly_interest_rate = annual_interest_rate / 12
number_of_payments = 0
payment = 10
while balance > 0:
number_of_payments += 1
balance -= payment
balance += balance * monthly_interest_rate
print(number_of_payments, payment, balance)
payment += 10
This outputs:
1 10 4842.38333333
2 20 4902.75638889
3 30 4953.96899537
4 40 4995.86847863
5 50 5028.29961994
6 60 5051.1046136
7 70 5064.12302383
8 80 5067.19174089
9 90 5060.14493657
10 100 5042.81401885
11 110 5015.02758583
12 120 4976.61137893
13 130 4927.38823524
14 140 4867.17803917
15 150 4795.79767315
16 160 4713.0609677
17 170 4618.7786505
18 180 4512.75829467
19 190 4394.80426625
20 200 4264.71767069
21 210 4122.29629853
22 220 3967.33457018
23 230 3799.62347968
24 240 3618.95053767
25 250 3425.0997133
26 260 3217.85137519
27 270 2996.98223144
28 280 2762.26526863
29 290 2513.46968978
30 300 2250.36085127
31 310 1972.7001988
32 320 1680.24520211
33 330 1372.74928881
34 340 1049.96177696
35 350 711.627806573
36 360 357.488270016
37 370 -12.7202588168

Resources