I'm trying to learn how to use the pandas library.
For the data source, I use the lottery combinations draws so far.
One of many tasks I'm trying to solve is to count the frequency of pairs of numbers in combinations.
I create a data frame from the list like this:
list = [
[13, 14, 28, 30, 31, 37, 39],
[7, 10, 12, 16, 21, 22, 33],
...,
[1, 2, 7, 15, 25, 31, 33],
[3, 6, 18, 21, 31, 34, 39]
]
df = pd.DataFrame(list)
print(df.head())
Output:
. 0 1 2 3 4 5 6
0 9 11 12 18 20 26 35
1 10 13 15 20 21 25 35
2 1 8 17 21 22 27 34
3 10 13 17 18 21 29 37
4 5 8 12 17 19 21 37
For example, as a result I want to get the sum of how much time tuples of two or three numbers appear together in combinations:
Pair : Found n time in all combinations
9,23 : 33
11,32 : 26
Can you give me some directions or example how to solve this task, please?