Hopefully someone can help.
I am running a prediction league in work. To help me calculate scores I thought I would use Excel.
These are the conditions for my league
Exact score = 3 pts
Points for correct goal difference = 2pts, i.e. if predicted score is 2-2 and the actual score is 1-1 then goal difference in both case =0 goals, so 2pts should be awarded
Correct result but wrong score = 1pt (home or away win)
Can't post images so here is a quick mockup
- HOME HOME AWAY AWAY Home Away Pts
- Norwich 0 0 West Ham 1 1 2
- Arsenal 3 1 Southampton 7 2 1
- Aston Villa 2 0 Swansea 0 1 0
- Fulham 3 0 West Brom 1 1 0
- Man Utd 4 0 Wigan 2 0 1
- Q.P.R. 0 0 Chelsea 0 0 3
- Stoke 1 1 Man City 1 3 0
- Sunderland 1 2 Liverpool 1 2 3
- Reading 1 3 Tottenham 0 2 2
- Everton 2 0 Newcastle 4 1 1
Something like this should work. Assuming that one set of results is in A1:B1 and the other in C1:D1. Home team listed first as usual in UK football fixtures.
=IF(AND(A1=C1,B1=D1),3,IF((A1-B1)=(C1-D1),2,IF(SIGN(A1-B1)=SIGN(C1-D1),1,0)))
Related
My data looks like this:
It is grouped by "name"
name star atm food foodcp drink drinkcp clean cozy service
___Backyard Jr. (__Xinyi) 4 4 4 4 4 0 4 0 0
___Backyard Jr. (__Xinyi) 3 0 3 0 3 0 0 0 3
___Backyard Jr. (__Xinyi) 4 0 0 0 4 0 0 0 0
___Backyard Jr. (__Xinyi) 3 0 0 0 0 0 0 3 3
I want to calculate the mean of all columns except for name, which will ignore the "0" and it will be done within groups. How can I do it?
I've tried use
df.groupby('name',as_index=False).mean()
but it dose calculate the "0".
Thank you for your help!!
You can first replace all the zeros by NaN:
df = df.replace(0, np.nan)
These nan values will be excluded from your mean.
I am trying to use offset function in excel to dynamically calculate sales since launch of products (3 months after, 6 months after etc.). For eg. for item 1 first 3 months of sale is 2557+10000+14487= 27044 and similarly for item 2 first 3 months sale will be 2557+11853+14487=28897
Any guidance on this is super appreciated!!
Items
Item1
Item2
Jan-20
0
0
Feb-20
0
0
Mar-20
0
0
Apr-20
0
0
May-20
0
2557
Jun-20
0
11853
Jul-20
0
14487
Aug-20
0
11375
Sep-20
0
10938
Oct-20
0
10842
Nov-20
0
15132
Dec-20
0
19820
Jan-21
2557
20726
Feb-21
10000
25072
Mar-21
14487
28897
Apr-21
11375
28665
May-21
10938
42358
Jun-21
10842
25619
Jul-21
15132
20575
Aug-21
19820
23315
Sep-21
20726
21346
Oct-21
25072
19377
Yes, avoid offset. You could use index/match for example:
=SUM(INDEX(B:B,MATCH(0,B:B)+1):INDEX(B:B,MATCH(0,B:B)+3))
My data are in MS Excel:
Col A Col B Col C Col D
1 amy john bob andy
2 andy mel amy john
3 max andy jim bob
4 wil steve andy amy
So, in 4x4 table there are 9 different values.
I need to create table to find how many times each PAIR is occurring in the same ROW. Something like this:
amy andy bob jim john max mel steve will
amy 0
andy 3 0
bob 1 2 0
jim 0 1 1 0
john 2 2 1 0 0
max 0 1 1 1 0 0
mel 1 1 0 0 1 0 0
steve 1 1 0 0 0 0 0 0
will 1 1 0 0 0 0 0 1 0
And I have no clue how to do it...
To reiterate: no duplicated values in each row, each row has unique values, each value in separate cell, so there are column with values and within column values can duplicate.
Any help will be much appreciated!
Assuming your data is in A5:D8 I proceeded like this -
created a helper column with the formula (copied downwards)
=A5&"-"&B5&"-"&C5&"-"&D5
Named this helper column as helper (named range)
listed down and across the unique combinations of names in H4:P4 (across) and G5:G13 (down)
enter this formula in H5 and copy it both downwards and across to fill all 9x9 matrix
=IF($G5=H$4,0,COUNTIFS(helper,"*"&$G5&"*",helper,"*"&H$4&"*"))
Your desired matrix is ready
A detailed blog is available on web for this.
I have trained a Neural Network to make prediction of outcome(Win/Lose) of a hockey game based on a few metrics.
The data I have been feeding it looks like this:
Each row represents a team in one game, so two specific rows make a match.
Won/Lost Home Away metric2 metric3 metric4 team1 team2 team3 team4
1 1 0 10 10 10 1 0 0 0
0 0 1 10 10 10 0 1 0 0
1 1 0 10 10 10 0 0 1 0
0 0 1 10 10 10 0 0 0 1
The predictions from the NN looks like this.
[0.12921564 0.87078434]
[0.63811845 0.3618816 ]
[5.8682327e-04 9.9941313e-01]
[0.97831124 0.02168871]
[0.04394475 0.9560553 ]
[0.76859254 0.23140742]
[0.45620263 0.54379743]
[0.01509337 0.9849066 ]
I believe I understand that the first column is for Lost(0), and second is for Won(1),
but what I don't understand is: Who won against who?
I don't now what to make of these predictions, do they even mean anything to me this way?
According to the Data Set you show here, it seems that the results of the network would show the probability of wining or losing a team in a match depending on the Race Host. I think you should add one more feature to your data set which shows the rival team in the match if you want your network to show the probability of wining the game against other team and the hosting situation( And if hosting is not important for you then you should remove Home and Away columns).
Let us take first two rows of your dataset,
Won/Lost Home Away metric2 metric3 metric4 team1 team2 team3 team4
1 1 0 10 10 10 1 0 0 0
0 0 1 10 10 10 0 1 0 0
#predictions
[0.12921564 0.87078434]
[0.63811845 0.3618816 ]
Team 1 played a game in its home and won the match. Model prediction also aligns with it because it has assigned high probability in the second column, which is the probability of winning as you mentioned.
Similarly Team 2 played a game away and lost the match. Model prediction aligns here as well!
you just mentioned that two specific rows make a match but with available information we cannot say who played with whom. Its just a model to predict the probability of winning for a particular team independently.
EDIT:
Assuming that you have data like this!
gameID Won/Lost Home Away metric2 metric3 metric4 team1 team2 team3 team4
2017020001 1 1 0 10 10 10 1 0 0 0
2017020001 0 0 1 10 10 10 0 1 0 0
You could transform the data as follows, which can improve the model.
Won/Lost metric2 metric3 metric4 h_team1 h_team2 h_team3 h_team4 a_team1 a_team2 a_team3 a_team4
1 10 10 10 1 0 0 0 0 1 0 0
Note: won/Lost value would be for home team, which is mentioned by h_team.
i have a list where employees are listed and next to it the clients afther that a 1 or 0 if there has been contact with the cliƫnts for longer than 3 months
now i want to visualise the list but i cant get the total per employee. i have grouped by employee but that doesn't seem te work.
example:
**Employee Cliƫntname longer than 3 months**
1 1 0
1 33 1
1 12 0
**total 1**
2 2 1
2 3 1
**total 2**
can anyone help me with this
Have you tried:
total([longer than 3 months] for [Employee])