I'm using the following snippet to catch all debts belonging to a customer belonged to an account number which is unique. However, I get duplicates of the account numbers even I have chosen it as the key. I'm too amazed.
var records = myList;
var groupedList = records?
.GroupBy(x => x.AccountNumber.Where(char.IsDigit).ToArray())
.Select(e => new {
AccountNumber = new string(e.Key),
TotalDebt = e.Sum(x => x.TotalDebt)
}
);

Apparently you expect your AccountNumbers to contain characters that are not digits, and you don't want to consider them. You want AccountNumbers that contain only digits.
To prevent to remove the digits more than once per AccountNumber, my advice would be to use an extra Select for this.
After removing the non-characters, consider to convert the AccountNumber to an int, this would speed up your processing considerably. If you don't want to convert it to int, remove the Parse part.
Another advice for this: Never let your LINQ statements return NULL. The result of your LINQ statements (as long as it returns
IEnumerable<...>) represents a sequence of similar items. If there are no items in the sequence, return an empty sequence. This has the advantage that you don't have to check if the input is null.Now you can be certain that groupedList is a non-null sequence. If myList was null, then groupedList is an empty sequence.