About 50 results
Open links in new tab
  1. python - How do I count the occurrences of a list item? - Stack Overflow

    Apr 8, 2010 · 2224 Given a single item, how do I count occurrences of it in a list, in Python? A related but different problem is counting occurrences of each different element in a collection, getting a …

  2. python - How to count the frequency of the elements in an unordered ...

    119 Python 2.7+ introduces Dictionary Comprehension. Building the dictionary from the list will get you the count as well as get rid of duplicates.

  3. python - Using a dictionary to count the items in a list - Stack Overflow

    Sep 12, 2019 · If you are only interested in counting instances of a single element in a list, see How do I count the occurrences of a list item?.

  4. python - Count the number of occurrences of a character in a string ...

    How do I count the number of occurrences of a character in a string? e.g. 'a' appears in 'Mary had a little lamb' 4 times.

  5. syntax - Python integer incrementing with ++ - Stack Overflow

    In Python, you deal with data in an abstract way and seldom increment through indices and such. The closest-in-spirit thing to ++ is the next method of iterators.

  6. python - Count number of occurrences of a substring in a string - Stack ...

    How can I count the number of times a given substring is present within a string in Python? For example:

  7. python - How do I get the row count of a Pandas DataFrame ... - Stack ...

    Apr 11, 2013 · 173 How do I get the row count of a Pandas DataFrame? This table summarises the different situations in which you'd want to count something in a DataFrame (or Series, for …

  8. python - Count the frequency that a value occurs in a dataframe …

    df.groupby('a').count() doesn't work if you have multiple columns. It will give you a ncol x nvals dataframe. That's nice when you only have one column, but when you have 10's or 100's of columns, …

  9. python - How do I count occurrence of unique values inside a list ...

    Sep 5, 2012 · So I'm trying to make this program that will ask the user for input and store the values in an array / list. Then when a blank line is entered it will tell the user how many of those values are uni...

  10. Alternative to list.count( ) in python - Stack Overflow

    count += 1 return count What this does: it loops over each item in seq, and if that item is equal to element, it adds 1 to count (which is initially 0) and then returns count after the loop ends. Using a for …