I’m looking for a methode of counting the total occurences of (common) elements in mutliple data sets while ignoring duplicates inside the same data set. This could either be an application, an excel function I was too stupid to find on Google or maybe a SQL snippet.
The specific use case is the analysis of key animator credits for arround 100 movies and tv series for an essay I’m working on.
I tried googling different things, but I couldn’t find anything that wouldn’t entail programing a whole tool: Does anyone have a quicker to realize idea?
Here a schematic example of what I’m looking for:
Set 1
Name A
Name A
Name B
Set 2
Name A
Name C
Set 3
Name A
Name C
Name D
Output
3: Name A (Set 1, Set 2, Set 3)
2: Name C (Set 2, Set 3)
1: Name B (Set 1)
1: Name D (Set 3)
Taken from here but adapted to ES6.
Javascript
// datasets
const dataSetOne = ["Name A", "Name B", "Name C"]
const dataSetTwo = ["Name A", "Name C"]
const dataSetThree = ["Name A", "Name C", "Name D"]
// merge
const data = [...dataSetOne, ...dataSetTwo, ...dataSetThree]
// filter
const uniqueData = data.filter( (value, index, self) => {
return self.indexOf(value) === index;
})
Note this also works for key-value objects; like in JSON format although would need to be adapted slightly.
So if you had a giant list(s) in a JSON format you could simply plug in your data and try this.
If you want to know which set it occurs in then another variable would be needed to used to keep track of this.
Okay, I kinda overreacted … This was super easy to put together in Python.
It also outputs an excel sheet and runs the entries through a .json-library of translations for Japanese and Chinese names.