2014-09-30 59 views
1

我對如何找到最活躍和最不活躍的客戶有疑問。Python:計算最多和最不活躍的客戶

我們被給了一組不同的名字。例如"sam, sam, luke, luke, luke"

我們被要求使用python(spyder)查找最常用的名稱和最不頻繁的名稱。這些結果需要wxFormBuilder的框中反映

我不確定我應該做什麼。

這裏是我迄今爲止爲尋找最活躍的客戶:

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 

謝謝!

+1

我們(希望)不會爲你做你的功課。你怎麼試圖解決這個問題? – Ideasthete 2014-09-30 18:11:08

回答

0

我猜想,這是基本的數學,均值,中位數,模式的更多問題等

你可以把所有的名字到一個列表,並計算每種名稱,然後將它們寫回文本框。