Questions tagged [find-occurrences]
435 questions
0
votes
2 answers
Count Occurence in Json Array within objects
I have the below json from which I am trying to count the occurrence of tags like Latin America in Python. As it appears twice in, it should return 2 for "Latin America" and 1 for "Mexico", "Health" and "Costa Rica".
{
"AlJazeera_data": [
{
…

Ehtesham Abad
- 23
- 5
0
votes
1 answer
How to find the further occurrence of an element within a column
I have a dataframe with 6000 rows and one column. I have to find the same element of the column two, but maximizing the distance between them. An example with a list, would be:
list = [2,1,3,1,2,4,5,1,3,2,1,5]
I would like the output to be the…
0
votes
1 answer
In PowerBI (DAX) how to total sum in the first and last year for only names that are present in all years
Need help with Power BI DAX to be find total amount in the first year for only those names that are present in all the years.
Here is a sample table:
Name Year Amount
A 2015 100
B 2015 50
C 2015 150
A 2016 200
B 2016 …

Naresh
- 3
- 1
0
votes
2 answers
bigram occurences to dictionary python
I would like to iterate through the list:
inc_list = ['one', 'two', 'one', 'three', 'two', 'one', 'three']
and create a dictionary that shows all bigrams of neighboring words and the number their occurrences, while counting reversed order…

Johannes Jamrosz
- 31
- 6
0
votes
2 answers
Create co-occurrence matrix from dictionary key, value(s) in Python
I am trying to create a co-occurrence matrix from a dictionary of unique keys with overlapping values (in Python 3). Here is my data structure:
keys = ['A','B','C','D']
vals = [[1,2],1,[1,3],2]
dict = {'A':[1,2], 'B':1, 'C':[1,3], 'D':2]}
How…

AHN
- 1
0
votes
3 answers
Indicate which vowel occurs the most in a string
I am writing a program in Java that is supposed to give an output like this:
vowels = 8
upper = 2
digits = 5
whitespace = 6
vowel i occurs the most = 4
My code compiles and I was successful with everything except determining which vowel occurs the…

agung
- 3
- 3
0
votes
1 answer
Find highest frequent element (the smallest one if possible) and its occurrences in integer array
Problems: Find 2 things
The highest occurrence in an given unsorted integer array
The element that has the highest occurrence and if there are more than one element satisfy (have the same highest occurrence) the result is the smallest…

ZAC Nguyen Hoang
- 17
- 7
0
votes
2 answers
Count and Assign Consecutive Occurrences of Variable
I wish to count consecutive occurrence of any value and assign that count to that value in next column. Below is the example of input and desired output:
dataset <- data.frame(input = c("a","b","b","a","a","c","a","a","a","a","b","c"))
dataset$count…

Ajay
- 320
- 2
- 11
0
votes
3 answers
Count occurrences across columns in SQL Server
I want to update a column based on the occurrences of values in multiple columns.
SQL Server 2017 schema setup:
CREATE TABLE Table1 (Part varchar(10),Jan int,Feb int,Mar int,Apr int,Occurrences int)
INSERT INTO Table1…

vicky
- 249
- 5
- 16
0
votes
0 answers
Read more files and find max occurence
I have 4 files .txt in my directory.
My objective is:
1) run a code that find max occurrence
2) take the execution time for each file
3) save execution times in a csv file
4) print an average of the execution times
I've done this:
import…
0
votes
2 answers
How to find the occurrences letters of a string for given number in PHP
I have string
$str = 'street';
and I want to write a function
output($str, $n)
Here the $n is the count for number of occurrences in the given string.
I don't want to use any PHP inbuilt functions like converting it to array first or substr_count…

Kendrick
- 43
- 5
0
votes
3 answers
How do I print all the occurrences of the greatest two integers in an array?
I am trying to print the occurrences of the two highest integers in an integer array but the output keeps coming out with the top three.
Integer[] scores = {4,4,4,6,6,4,2,3};
Arrays.sort(scores, Collections.reverseOrder());
int…

friedwanton
- 1
- 2
0
votes
1 answer
Locating right file in the directory with keywords and comparison in R
I am very new to r and I have no experience with regular expressions and any help would be really appreciated.
I am reading in a dir and I am trying to find files with the number "22953" and then I want to read the newest file containing this. The…

Youssef Yassine
- 23
- 7
0
votes
2 answers
Problem to get more than 1 element with same highest occurrence from array in Perl
I only get the smaller element as output although there are 2 elements with same highest occurrence in array
I have tried to remove sort function from the codes but it still returns me the smaller element
my(@a) = (undef,11,12,13,14,15,13,13,14,14);…

user6201481
- 39
- 6
0
votes
1 answer
Union of two linked lists using multiplicity function with in C++
I need to make an union of two unordered multisets passed from input, by using the "multiplicity" definition: The multiplicity of an element, also called absolute frequency, is the number of occurrences of the element 'x' in the unordered multiset…

Anna
- 83
- 1
- 7