Hi, I'm still trying to get value_counts from multiple columns of a csv file this code:
Any help much appreciated.
Thanks
David
Here's the sample lotto-0807-1218.csv
import pandas as pd df = pd.read_csv("lotto-0807-1218.csv") print(df['Num 1'].value_counts().to_frame())Prints the correct value counts for a single column, but how would I get value counts over multiple columns, if I try
print(df['Num 1', 'Num 2'].value_counts().to_frame())I get:
Error:KeyError: ('Num 1', 'Num 2')
I want the total for multiple columns not per columnAny help much appreciated.
Thanks
David
Here's the sample lotto-0807-1218.csv
Num 1,Num 2,Num 3,Num 4,Num 5,Num 6
15,21,23,27,36,37
8,11,13,18,25,31
1,3,7,9,15,22
7,8,25,31,32,35
3,5,8,18,19,29
2,12,14,18,22,25
3,5,16,18,21,26
6,16,23,24,30,33
9,20,25,27,34,37
16,18,20,22,24,25
8,9,13,14,27,29
2,7,9,19,24,25
4,8,13,20,27,29
6,7,11,17,22,29
11,17,19,25,27,28