Questions tagged [frequency]
The rate at which a thing occurs or is found.
frequency
2,870
questions
500
votes
16
answers
1.2m
views
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 return something like the following which shows the unique values and their frequencies
category freq
cat a 2
cat b 1
288
votes
33
answers
700k
views
How to count the frequency of the elements in an unordered list? [duplicate]
Given an unordered list of values like
a = [5, 1, 2, 2, 4, 3, 1, 2, 3, 1, 1, 5, 2]
How can I get the frequency of each value that appears in the list, like so?
# `a` has 4 instances of `1`, 4 of `2`, ...
244
votes
11
answers
287k
views
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/...
183
votes
2
answers
100k
views
What values are valid in Pandas 'Freq' tags?
I am trying to use date_range. I came across some values valid 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.
What values are valid in ...
127
votes
7
answers
167k
views
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 ...
116
votes
4
answers
148k
views
How can I compute a histogram (frequency table) for a single Series?
How can I generate a frequency table (or histogram) for a single Series? For example, if I have my_series = pandas.Series([1,2,2,3,3,3]), how can I get a result like {1: 1, 2: 2, 3: 3} - that is, a ...
103
votes
7
answers
102k
views
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, ...
94
votes
15
answers
288k
views
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 ...
69
votes
14
answers
150k
views
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(...
58
votes
6
answers
115k
views
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 = ...
53
votes
9
answers
219k
views
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 ...
53
votes
11
answers
187k
views
How to find most common elements of a list? [duplicate]
Given the following list
['Jellicle', 'Cats', 'are', 'black', 'and', 'white,', 'Jellicle', 'Cats',
'are', 'rather', 'small;', 'Jellicle', 'Cats', 'are', 'merry', 'and',
'bright,', 'And', '...
49
votes
3
answers
72k
views
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, ...
46
votes
6
answers
62k
views
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 ...
44
votes
1
answer
81k
views
How to use dplyr to generate a frequency table
I like to create a table that has the frequency of several columns in my data frame. I am copying part of my data frame below.
The table is supposed to have frequency (both n and %) of "red" in ...
39
votes
4
answers
69k
views
Python frequency detection
Ok what im trying to do is a kind of audio processing software that can detect a prevalent frequency an if the frequency is played for long enough (few ms) i know i got a positive match. i know i ...
39
votes
1
answer
38k
views
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 ...
36
votes
3
answers
36k
views
Graphing the pitch (frequency) of a sound
I want to plot the pitch of a sound into a graph.
Currently I can plot the amplitude. The graph below is created by the data returned by getUnscaledAmplitude():
AudioInputStream audioInputStream = ...
36
votes
5
answers
23k
views
Bash script to find the frequency of every letter in a file
I am trying to find out the frequency of appearance of every letter in the english alphabet in an input file. How can I do this in a bash script?
35
votes
8
answers
45k
views
Java equivalent of C# system.beep?
I am working on a Java program, and I really need to be able to play a sound by a certain frequency and duration, similarly to the c# method System.Beep, I know how to use it in C#, but I can't find a ...
35
votes
4
answers
56k
views
Setting a relative frequency in a matplotlib histogram
I have data as a list of floats and I want to plot it as a histogram. Hist() function does the job perfectly for plotting the absolute histogram. However, I cannot figure out how to represent it in a ...
34
votes
5
answers
101k
views
How to generate a frequency table in R with with cumulative frequency and relative frequency
I'm new with R. I need to generate a simple Frequency Table (as in books) with cumulative frequency and relative frequency.
So I want to generate from some simple data like
> x
[1] 17 17 17 17 ...
25
votes
12
answers
6k
views
Python - Is a dictionary slow to find frequency of each character?
I am trying to find a frequency of each symbol in any given text using an algorithm of O(n) complexity. My algorithm looks like:
s = len(text)
P = 1.0/s
freqs = {}
for char in text:
try:
...
24
votes
8
answers
49k
views
Sort list by frequency
Is there any way in Python, wherein I can sort a list by its frequency?
For example,
[1,2,3,4,3,3,3,6,7,1,1,9,3,2]
the above list would be sorted in the order of the frequency of its values to ...
22
votes
5
answers
18k
views
Show frequencies along with barplot in ggplot2
I'm trying to display frequencies within barplot ... well, I want them somewhere in the graph: under the bars, within bars, above bars or in the legend area. And I recall (I may be wrong) that it can ...
21
votes
3
answers
22k
views
NLTK tokenize - faster way?
I have a method that takes in a String parameter, and uses NLTK to break the String down to sentences, then into words. Afterwards, it converts each word into lowercase, and finally creates a ...
20
votes
1
answer
55k
views
Plot Histogram in Python
I have two lists, x and y.
x contains the alphabet A-Z and Y contains the frequency of them in a file.
I've tried researching how to plot these values in a histogram but has had no success with ...
20
votes
1
answer
50k
views
ValueWarning: No frequency information was provided, so inferred frequency MS will be used
I try to fit Autoregression by sm.tsa.statespace.SARIMAX. But I meet a warning, then I want to set frequency information for this model.
Who used to meet it, can you help me ?
fit1 = sm.tsa....
20
votes
3
answers
14k
views
android getting sound frequencies real time?
I have been trying to get the sound frequency(number) in real time using fft and i am having run time errors. can any one help?
package com.example.recordsound;
import edu.emory.mathcs.jtransforms....
19
votes
10
answers
24k
views
Detecting the fundamental frequency [closed]
There's this tech-festival in IIT-Bombay, India, where they're having an event called "Artbots" where we're supposed to design artbots with artistic abilities. I had an idea about a musical robot ...
17
votes
1
answer
19k
views
Most Efficient way to calculate Frequency of values in a Python list?
I am looking for a fast and efficient way to calculate the frequency of list items in python:
list = ['a','b','a','b', ......]
I want a frequency counter which would give me an output like this:
[ ...
16
votes
2
answers
63k
views
Determine frequency from signal data in MATLAB
I have data from a sensor and I need to find the frequency of it. It looks like fft() seems to be the way to go, but the MATLAB docs only show how to get a graph of the frequencies, I don't know what ...
16
votes
2
answers
60k
views
Split multiple delimiters in Java [closed]
How I can split the sentences with respect to the delimiters in the string and count the frequency of words ?
String delimiters = "\t,;.?!-:@[](){}_*/";
My text file is:
Billy_Reeves
Smorz
...
15
votes
10
answers
10k
views
C# Why are timer frequencies extremely off?
Both System.Timers.Timer and System.Threading.Timer fire at intervals that are considerable different from the requested ones.
For example:
new System.Timers.Timer(1000d / 20);
yields a timer that ...
15
votes
5
answers
695
views
How to get the most frequent row in table
How to get the most frequent row in a DataFrame?
For example, if I have the following table:
col_1 col_2 col_3
0 1 1 A
1 1 0 A
2 0 1 A
3 1 1 ...
15
votes
3
answers
8k
views
Explain the FFT to me
I want to take audio PCM data and find peaks in it. Specifically, I want to return the frequency and time at which a peak occurs.
My understanding of this is that I have to take the PCM data and ...
15
votes
4
answers
12k
views
Divide each each cell of large matrix by sum of its row
I have a site by species matrix. The dimensions are 375 x 360. Each value represents the frequency of a species in samples of that site.
I am trying to convert this matrix from frequencies to ...
14
votes
2
answers
31k
views
Calculating Entropy
I've tried for several hours to calculate the Entropy and I know I'm missing something. Hopefully someone here can give me an idea!
EDIT: I think my formula is wrong!
CODE:
info <- function(...
14
votes
4
answers
55k
views
Python - Finding word frequencies of list of words in text file
I am trying to speed up my project to count word frequencies. I have 360+ text files, and I need to get the total number of words and the number of times each word from another list of words appears. ...
14
votes
1
answer
15k
views
How often should sp_updatestats be called?
A question of mine which dealt with a slowly executing query introduced me to the sp_updatestats() function. I want to take pro-active steps to call it on a regular basis rather that wait for my ...
14
votes
7
answers
6k
views
Determining Word Frequency of Specific Terms
I'm a non-computer science student doing a history thesis that involves determining the frequency of specific terms in a number of texts and then plotting these frequencies over time to determine ...
14
votes
1
answer
7k
views
iOS FFT Accerelate.framework draw spectrum during playback
UPDATE 2016-03-15
Please take a look at this project: https://github.com/ooper-shlab/aurioTouch2.0-Swift. It has been ported to Swift and contains every answer you're looking for, if you cam here.
I ...
14
votes
1
answer
3k
views
Swift FFT - Complex split issue
I am trying to perform FFT on an audio file to find frequency using the Accelerate framework. I have adapted code (probably wrong) from this question: Spectrogram from AVAudioPCMBuffer using ...
13
votes
6
answers
6k
views
Count appearances of a value until it changes to another value
I have the following DataFrame:
df = pd.DataFrame([10, 10, 23, 23, 9, 9, 9, 10, 10, 10, 10, 12], columns=['values'])
I want to calculate the frequency of each value, but not an overall count - the ...
13
votes
3
answers
1k
views
Plot weighted frequency matrix
This question is related to two different questions I have asked previously:
1) Reproduce frequency matrix plot
2) Add 95% confidence limits to cumulative plot
I wish to reproduce this plot in R:
...
13
votes
1
answer
6k
views
Elasticsearch word frequency and relations
I am wondering if it is possible at all to get the top ten most frequent words in an Elasticsearch field across an entire index or alias.
Here is what I'm trying to do:
I am indexing text documents ...
12
votes
2
answers
16k
views
Make a table of string frequency
I am trying to make a summary table of many strings. My data looks like this:
x<-c("a", "a", "b", "c", "c", "c", "d")
How would I analyse the recurrence of each string at once? Ideally to produce ...
12
votes
2
answers
3k
views
How to get top K elements from count-min-sketch?
I'm reading how the probabilistic data structure count-min-sketch is used in finding the top k elements in a data stream. But I cannot seem to wrap my head around the step where we maintain a heap to ...
11
votes
4
answers
12k
views
Sorting entire csv by frequency of occurence in one column
I have a large CSV file, which is a log of caller data.
A short snippet of my file:
CompanyName High Priority QualityIssue
Customer1 Yes User
Customer1 Yes ...
11
votes
1
answer
7k
views
Normalizing FFT spectrum magnitude to 0dB
I'm using FFT to extract the amplitude of each frequency components from an audio file. Actually, there is already a function called Plot Spectrum in Audacity that can help to solve the problem. ...