I have database that I want to use make one list of numbers so I can count how many times each number occurs throughout the database. I want to use the columns Number_1 - Number_5. The most I've been able to do is just make separate lists for each column. To clarify further, I want the list to look something like this: list_of_numbers = (11,18,5,14,31,26,12,37,12,13,3,2,4,14,41,22,31,26,15,35,32,20,49,20,15,7,5,10,18,58,...)
BTW, the database is pretty big, so the list is going to have 7650 elements to it It looks something like this:
Draw # Draw DateNumber_1Number_2Number_3Number_4Number_5Mega 1004 Tue. Feb 03, 2015 11 22 25 58 69 13 1003 Fri. Jan 30, 2015 18 31 39 45 55 6 1002 Tue. Jan 27, 2015 5 26 27 44 57 7 1001 Fri. Jan 23, 2015 14 15 32 68 72 8 1000 Tue. Jan 20, 2015 31 35 56 59 63 6 999 Fri. Jan 16, 2015 26 32 44 45 58 11 998 Tue. Jan 13, 2015 12 20 25 50 51 7 997 Fri. Jan 09, 2015 37 49 50 56 57 8 996 Tue. Jan 06, 2015 12 20 27 38 75 4 995 Fri. Jan 02, 2015 13 15 35 62 74 12 994 Tue. Dec 30, 2014 3 7 44 63 67 12 993 Fri. Dec 26, 2014 2 5 10 20 38 14 992 Tue. Dec 23, 2014 4 10 31 56 66 7 991 Fri. Dec 19, 2014 14 18 58 59 68 4 990 Tue. Dec 16, 2014 41 58 68 72 73 1
df.iloc[:, -6: -1].values.T.ravel()
yields
array([11, 18, 5, 14, 31, 26, 12, 37, 12, 13, 3, 2, 4, 14, 41, 18, 5,
14, 31, 26, 12, 37, 12, 13, 3, 2, 4, 14, 41, 31, 26, 15, 35, 32,
20, 49, 20, 15, 7, 5, 10, 18, 58, 39, 27, 32, 56, 44, 25, 50, 27,
35, 44, 10, 31, 58, 68, 45, 44, 68, 59, 45, 50, 56, 38, 62, 63, 20,
56, 59, 72, 55, 57, 72, 63, 58, 51, 57, 75, 74, 67, 38, 66, 68, 73,
6, 7, 8, 6, 11, 7, 8, 4, 12, 12, 14, 7, 4, 1])
You can call the tolist()
method on the resulting array if you prefer lists.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments