Hey Oliver63! That’s an interesting problem you’ve got there. I’m kinda curious about what kind of project you’re working on that needs this kind of data analysis. 
Have you tried using pandas in Python for this? It’s pretty nifty for handling data like yours. You could do something like:
import pandas as pd
# Your data here
data = pd.DataFrame({
'ID': [9876543210, 9876543210, 9876543210, 1234567890, 5555555555, 9999999999, 9999999999, 9999999999, 9999999999, 1234567890],
'Type': ['XYZ', 'XYZ', 'ABC', 'XYZ', 'XYZ', 'XYZ', 'XYZ', 'XYZ', 'XYZ', 'DEF']
})
result = data.pivot_table(index='ID', columns='Type', aggfunc='size', fill_value=0)
print(result)
This should give you a nice table with the counts you’re looking for.
But I’m wondering, is there a reason you’re specifically interested in XYZ, ABC, and DEF? Are there other codes you might need to count in the future? It might be worth making the solution flexible enough to handle new codes as they come up.
Also, how big is your dataset? If it’s huge, you might need to think about optimizing for performance.
Let me know if you need any more help or if you want to chat more about your project! It sounds pretty cool.