Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Pandas - cumulative sum of two columns
Post: RE: Pandas - cumulative sum of two columns
This works perfect! Thank you so much, i really appreciate the time and effort you and other great coders put in here to help us newbs. Hope i can contribute myself someday. Thanks again, i would not ... |
|
tobbs |
Data Science |
12 |
8,789 |
May-25-2019, 08:37 PM |
|
|
Thread: Pandas - cumulative sum of two columns
Post: RE: Pandas - cumulative sum of two columns
Thanks that sorted out the season problem! Yeah you are right, season is what matters actually. However year equeals season in this case.
I realised i did i stupid mistake in my example, i only disp... |
|
tobbs |
Data Science |
12 |
8,789 |
May-25-2019, 11:28 AM |
|
|
Thread: Pandas - cumulative sum of two columns
Post: RE: Pandas - cumulative sum of two columns
Yes, that works! Thank you so much, i've been struggling with this one.
I need to make a change though, the points need to be reset every year since i'm reading data from 4-5 years back. Is there a ... |
|
tobbs |
Data Science |
12 |
8,789 |
May-25-2019, 07:46 AM |
|
|
Thread: Pandas - cumulative sum of two columns
Post: RE: Pandas - cumulative sum of two columns
Okey a different approach for the same problem. I have the same results but instead of points i have a value for either home win (H), draw (D) or away win (A). A win is 3 points for the winning team a... |
|
tobbs |
Data Science |
12 |
8,789 |
May-24-2019, 09:22 PM |
|
|
Thread: Pandas - cumulative sum of two columns
Post: RE: Pandas - cumulative sum of two columns
Yea, i use cumsum but i can only get either the home points or the away points, like this:
df['H_cumsum'] = df['H_points'].cumsum().shift(1)
df['A_cumsum'] = df['A_points'].cumsum().shift(1)I just d... |
|
tobbs |
Data Science |
12 |
8,789 |
May-19-2019, 01:34 PM |
|
|
Thread: Pandas - cumulative sum of two columns
Post: RE: Pandas - cumulative sum of two columns
No that's not correct, the desired output is what i described at top. It's a score table for soccer teams. The team get 1 point for draw and 3 for victory. Therefor the cumlative score for Gothenburg ... |
|
tobbs |
Data Science |
12 |
8,789 |
May-19-2019, 11:43 AM |
|
|
Thread: Pandas - cumulative sum of two columns
Post: Pandas - cumulative sum of two columns
I want to calculate points for soccer teams. I have points for the hometeam and awayteam for each game and i want to get the sum for previous games. (not include the row i'm standing on) This is a par... |
|
tobbs |
Data Science |
12 |
8,789 |
May-19-2019, 09:29 AM |
|
|
Thread: sum a dictionary of classes
Post: RE: sum a dictionary of classes
Ah yeah sorry, i can see that now. But let's put it like this. I have a chunk of data (a list of list) and i want to get the sum of certain columns (Mean and hit) sorted by keys (Team, League, Odds gr... |
|
tobbs |
General Coding Help |
2 |
2,277 |
Mar-16-2019, 02:38 PM |
|
|
Thread: sum a dictionary of classes
Post: sum a dictionary of classes
Hi there,
I have a dictionary of classes. The class consists of data for soccer games with attributes like team, league, lists of results, lists of calculated values (floats). I want to get the sum (... |
|
tobbs |
General Coding Help |
2 |
2,277 |
Mar-15-2019, 04:54 PM |
|
|
Thread: Iterate over excel-sheets using xlrd
Post: RE: Iterate over excel-sheets using xlrd
Ah yes i see now. Big thank you! |
|
tobbs |
General Coding Help |
6 |
12,421 |
Feb-28-2019, 08:33 PM |
|
|
Thread: Iterate over excel-sheets using xlrd
Post: RE: Iterate over excel-sheets using xlrd
Please help a noob...
I have a new problem with a similar excel fil as above. This time however, i use append.sheet.row_values(i)[0] instead of just append.sheet.row_values(i) as above. Suddenly i g... |
|
tobbs |
General Coding Help |
6 |
12,421 |
Feb-28-2019, 07:48 PM |
|
|
Thread: Iterate over excel-sheets using xlrd
Post: RE: Iterate over excel-sheets using xlrd
Oh yeah, off course! Thank you :)
Another thing, any ideas how to get rid of the time in the date format? "2019, 2, 10, 0, 0, 0" and just display "2019, 2, 10" |
|
tobbs |
General Coding Help |
6 |
12,421 |
Feb-20-2019, 02:57 PM |
|
|
Thread: Iterate over excel-sheets using xlrd
Post: Iterate over excel-sheets using xlrd
Hi, i can't iterate over excel-sheets the way i want.
First the code without iteration, wiitch works fine;
xl_fil_resultat = xlrd.open_workbook("Data/resultat.xlsx")
sheet_resultat = xl_fil_resulta... |
|
tobbs |
General Coding Help |
6 |
12,421 |
Feb-20-2019, 01:57 PM |
|
|
Thread: Best way to get data from 2D array
Post: RE: Best way to get data from 2D array
Hi, i changed the model from reading csv-file to reading xlsx-file with xlrd and encounterd some weird problems.
here's the code:
xl_fil_resultat = xlrd.open_workbook("Data/resultat.xlsx")
s... |
|
tobbs |
General Coding Help |
23 |
8,374 |
Feb-19-2019, 04:08 PM |
|
|
Thread: Best way to get data from 2D array
Post: RE: Best way to get data from 2D array
Yeah that worked, Thank you! :) |
|
tobbs |
General Coding Help |
23 |
8,374 |
Dec-13-2018, 08:27 PM |
|
|
Thread: Best way to get data from 2D array
Post: RE: Best way to get data from 2D array
Main.py:
from Team_data import team_data_function
from Comparison import comparison_function
from Team_calc import team_calc_function
team_data_function()
comparison_function()
team_calc_function()T... |
|
tobbs |
General Coding Help |
23 |
8,374 |
Dec-13-2018, 07:04 PM |
|
|
Thread: Best way to get data from 2D array
Post: RE: Best way to get data from 2D array
I have problem accessing the class from another file. I think it has something to do with the dictionary i use to store the classes? I import the class and the function, but the error message says the... |
|
tobbs |
General Coding Help |
23 |
8,374 |
Dec-12-2018, 08:36 PM |
|
|
Thread: Best way to get data from 2D array
Post: RE: Best way to get data from 2D array
Wow, that would have taken me a year to figure out on my own. Thanks! :) |
|
tobbs |
General Coding Help |
23 |
8,374 |
Nov-22-2018, 06:44 PM |
|
|
Thread: Best way to get data from 2D array
Post: RE: Best way to get data from 2D array
Thanks again, your solution is so much clever, saves a lot of iterations! However, i don't get the results i want.
My code looks like this: (results = result_file in your example, row[2] = home team ... |
|
tobbs |
General Coding Help |
23 |
8,374 |
Nov-21-2018, 08:04 PM |
|
|
Thread: Best way to get data from 2D array
Post: RE: Best way to get data from 2D array
I’m trying to add the home- and away results for each team i create. My idea was to add a home_result list and an away_result list to the class attributes like below. Then i want to run the add functi... |
|
tobbs |
General Coding Help |
23 |
8,374 |
Nov-20-2018, 06:12 PM |