About 8,710,000 results
Open links in new tab
  1. python - How do I count the occurrences of a list item? - Stack …

    Apr 8, 2010 · 2219 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, …

  2. python - Letter Count on a string - Stack Overflow

    Python newb here. I m trying to count the number of letter "a"s in a given string. Code is below. It keeps returning 1 instead 3 in string "banana". Any input appreciated. def count_letters(word,...

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

    Apr 11, 2013 · 170 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 …

  4. 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 …

  5. python - Pandas, groupby and count - Stack Overflow

    Nov 16, 2017 · 0 -1 4 a 1 0 5 a 2 1 4 s 3 2 5 s 4 1 5 s And each value of session and revenue represents a kind of type, and I want to count the number of each kind say the number of …

  6. How do I measure elapsed time in Python? - Stack Overflow

    The python cProfile and pstats modules offer great support for measuring time elapsed in certain functions without having to add any code around the existing functions.

  7. python - Get loop count inside a for-loop - Stack Overflow

    Get loop count inside a for-loop [duplicate] Asked 15 years, 4 months ago Modified 3 years, 6 months ago Viewed 653k times

  8. Python: count repeated elements in the list - Stack Overflow

    Apr 23, 2014 · Closed 3 years ago. I am new to Python. I am trying to find a simple way of getting a count of the number of elements repeated in a list e.g.

  9. Python Count up & Down loop - Stack Overflow

    How can I simply transform this loop to count up from 1 to 100, and display the numbers? I'm starting to code recently. It works fine when counting down, but I can't figure out how to make …

  10. python - Count the number of occurrences of a character in a …

    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.