No guarantee that this works for all cases, but in a Drupal context (Drupal 9/Twig 2) I could successfully compare a variable to -1 in a for loop to differentiate numeric from non-numeric keys:
{% for i, items %} {% if i > -1 %} ...