Questions tagged [frequency]

The rate at which a thing occurs or is found.

The rate at which a thing occurs or is found.

2518 questions
379
votes
13 answers

Count the frequency that a value occurs in a dataframe column

I have a dataset category cat a cat b cat a I'd like to be able to return something like (showing unique values and frequency) category freq cat a 2 cat b 1
yoshiserry
  • 14,991
  • 24
  • 67
  • 96
256
votes
33 answers

How to count the frequency of the elements in an unordered list?

I need to find the frequency of elements in an unordered list a = [1,1,1,1,2,2,2,2,3,3,4,5,5] output-> b = [4,4,2,1,2] Also I want to remove the duplicates from a a = [1,2,3,4,5]
Bruce
  • 29,361
  • 67
  • 167
  • 252
179
votes
10 answers

Relative frequencies / proportions with dplyr

Suppose I want to calculate the proportion of different values within each group. For example, using the mtcars data, how do I calculate the relative frequency of number of gears by am (automatic/manual) in one go with…
jenswirf
  • 6,057
  • 8
  • 41
  • 62
111
votes
1 answer

What values are valid in Pandas 'Freq' tags?

I am new to Pandas, and am trying to use date_range. I came across all kinds of good things for freq, like BME and BMS and I would like to be able to quickly look up the proper strings to get what I want. Yesterday I found a nicely formatted table…
sundowner
  • 1,258
  • 2
  • 10
  • 7
104
votes
5 answers

Getting the count of unique values in a column in bash

I have tab delimited files with several columns. I want to count the frequency of occurrence of the different values in a column for all the files in a folder and sort them in decreasing order of count (highest count first). How would I accomplish…
sfactor
  • 10,810
  • 30
  • 92
  • 146
102
votes
4 answers

Frequency table for a single variable

One last newbie pandas question for the day: How do I generate a table for a single Series? For example: my_series = pandas.Series([1,2,2,3,3,3]) pandas.magical_frequency_function( my_series ) >> { 1 : 1, 2 : 2, 3 : 3 } Lots of…
Abe
  • 17,738
  • 21
  • 71
  • 103
83
votes
12 answers

Count frequency of words in a list and sort by frequency

I am using Python 3.3 I need to create two lists, one for the unique words and the other for the frequencies of the word. I have to sort the unique word list based on the frequencies list so that the word with the highest frequency is first in the…
user3088605
  • 861
  • 1
  • 8
  • 5
78
votes
7 answers

python equivalent of R table

I have a list [[12, 6], [12, 0], [0, 6], [12, 0], [12, 0], [6, 0], [12, 6], [0, 6], [12, 0], [0, 6], [0, 6], [12, 0], [0, 6], [6, 0], [6, 0], [12, 0], [6, 0], [12, 0], [12, 0], [0, 6], [0, 6], [12, 6], [6, 0], [6, 0], [12, 6], [12, 0], [12, 0], [0,…
Donbeo
  • 14,217
  • 30
  • 93
  • 162
65
votes
11 answers

Item frequency count in Python

Assume I have a list of words, and I want to find the number of times each word appears in that list. An obvious way to do this is: words = "apple banana apple strawberry banana lemon" uniques = set(words.split()) freqs = [(item,…
Daniyar
  • 1,520
  • 2
  • 14
  • 23
53
votes
6 answers

How to get the number of the most frequent value in a column?

I have a data frame and I would like to know how many times a given column has the most frequent value. I try to do it in the following way: items_counts = df['item'].value_counts() max_item = items_counts.max() As a result I get: ValueError:…
Roman
  • 97,757
  • 149
  • 317
  • 426
44
votes
3 answers

Getting frequency values from histogram in R

I know how to draw histograms or other frequency/percentage related tables. But now I want to know, how can I get those frequency values in a table to use after the fact. I have a massive dataset, now I draw a histogram with a set binwidth. I want…
MiMi
  • 479
  • 1
  • 5
  • 8
43
votes
8 answers

How to count how many values per level in a given factor?

I have a data.frame mydf with about 2500 rows. These rows correspond to 69 classes of objects in colum 1 mydf$V1, and I want to count how many rows per object class I have. I can get a factor of these classes with: objectclasses =…
Escher
  • 4,200
  • 6
  • 39
  • 78
42
votes
11 answers

How to find most common elements of a list?

Given the following list ['Jellicle', 'Cats', 'are', 'black', 'and', 'white,', 'Jellicle', 'Cats', 'are', 'rather', 'small;', 'Jellicle', 'Cats', 'are', 'merry', 'and', 'bright,', 'And', 'pleasant', 'to', 'hear', 'when', 'they', 'caterwaul.', …
user434180
  • 625
  • 1
  • 5
  • 7
39
votes
5 answers

Python library for playing fixed-frequency sound

I have a mosquito problem in my house. This wouldn't usually concern a programmers' community; However, I've seen some devices that claim to deter these nasty creatures by playing a 17Khz tone. I would like to do this using my laptop. One method…
Adam Matan
  • 107,447
  • 124
  • 346
  • 512
38
votes
1 answer

Android audio FFT to retrieve specific frequency magnitude using audiorecord

I am currently trying to implement some code using Android to detect when a number of specific audio frequency ranges are played through the phone's microphone. I have set up the class using the AudioRecord class: int channel_config =…
user723060
  • 383
  • 1
  • 4
  • 4
1
2 3
99 100