Menu

itemFrequency()

Version 1.1 and Later

This function has been removed due to its close similarity to the list.count() function built in to Python.

Version 1.0

Usage

itemFrequency(listobject, item)
  • Returns the frequency of item as it occurs in listobject.
  • listobject must be a list.
  • item can be any object type containable within a list.

Examples

>>> mylist = [1, 2, 3, 4, 4, 5, 6, 7, 7, 7, 8]
>>> from pydoodles import itemFrequency
>>> itemFrequency(mylist, 1)
1
>>> itemFrequency(mylist, 4)
2
>>> itemFrequency(mylist, 7)
3
>>> itemFrequency(mylist, 8)
1

Related

Blog: 2013/04/10-progress-report
Blog: 2013/05/11-released

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.