The universe is a set of companies. The data arrives as a set of listings. Those are different sets, and the difference is not cosmetic.
The bug, which is a modeling error
Concentration asks what share of the market its ten largest companies represent. The inputs are listings — one row per traded security — and some companies have more than one. A dual-class company trades under two tickers.
Now add the detail that makes it bite: the share count the provider returns is class-adjusted. Each listing's weighted share count already accounts for the whole company. So both tickers of a dual-class company independently price the entire firm, and keeping both put one company in the top ten twice, at full size, both times.
That is not a small distortion. It inflates the numerator, misstates the denominator, and pushes a genuine tenth-largest company out of the list — all from a set that was, in the narrow sense, entirely correct. Every row was real. Every value was right. The set was just answering a different question than the one being asked.
Choosing the identity
Ticker symbol is available, unique, and wrong: it identifies a listing. Company name is a string that varies by source and formatting. The right key is the regulatory filing identifier — a number issued per filing entity, which is exactly the identity a "company" has in this domain.
Two details in the implementation are worth stealing.
The fallback is per-row, not shared. A listing with no filing identifier falls back to its own symbol, not to an empty string. That matters more than it looks: an empty-string fallback would collapse every identifier-less listing into a single phantom company, which is a much worse bug than the one being fixed.
The collapse takes a maximum, never a sum. Since each listing already prices the whole company, adding them doubles it. So one listing becomes the face and the other is discarded — and the code carries a comment about it, because the next person to read it will absolutely wonder why it is not summing.
Read that comment carefully, though, because it and the code disagree. The comment says the more liquid listing is kept. The code keeps the one with the larger computed market cap; turnover only decided which listings entered the candidate pool in the first place, and becomes a tiebreak here at most. For a dual-class company the two usually agree, which is exactly why the discrepancy survives. A comment that is right most of the time is the hardest kind to notice being wrong.