I have a question on how to find the most and the least active customers.
We were given a group of different names. For example "sam, sam, luke, luke, luke"
We are asked to find the most frequent name and the least frequent name using python(spyder). These results need to be reflected in a box in wxFormBuilder
.
I am not sure what exactly I should do.
Here is what I have so far for looking for the most active customer:
def mostactive(self,parent):
for name in range (self.m_listBox1.GetCount()): <--- the name of the box is m_listBox1
mostactivecustomer=str(self.m_listBox1.GetString(name))
self.m_textCtrl2.Value(mostactivecustomer) <---- the result box is called m_textCtrl2
Thank you!
I would guess that this is more a question of basic maths, mean, median, mode etc.
You could put all the names into a list and count the names in each, then write them back to the text box.