Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a dataset ranging from 2007-2015 with 6 features (see image below). I would like to split the dataset into 2 datasets by setting a date cutoff. For example, I would like to split anything before 2014-26-03 in dataset 1 and anything after into dataset 2. However, the 'game_id' may appear multiple times as it will have multiple records (sometimes up to 35 records for one game).

In addition, I would like to combine the rows by matching game_id (so leaving me with one record per game_id) and averaging the score by level. So for example, for game_id 678 (as shown in image), output may look like this:

unique_id date game_id Level1_score Level2_score Level3_score

xxxx xxx 678 2 0 1.5

Unique_id and date will not be relevant beyond this point (but not sure how to handle this).

Any suggestions on the most efficient way to split data by date, average each level score by game_id and handle date and unique_id variables?

Thanks!

unique_id date game_id Level1_score Level2_score Level3_score
10144 10/4/06 81 0 0 0
19634 10/16/06 555 6 1 2
24797 10/19/06 123 0 2 1
20253 11/17/06 678 4 0 0
6867 11/30/06 654 1 5 2
1808 1/2/07 678 0 0 3
22543 1/2/07 209 3 3 0
12564 1/3/07 492 0 0 1
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900