count returning 2 while len is 0

books = Books.objects.select_related('author').filter(author_id=350)
<QuerySet []>

How is count returning 2 ?

Is this repeatable? (If you do this again now, do you get the same results?)
Are you doing this from the shell, or is this output that you are getting from a view?

What’s the relationship between Books and Author? OneToMany or ManyToMany?

Side note, be aware that books.count() does not count the number of elements in books. It creates a new query that gets executed on the database. So if something has happened between the time the books queryset is resolved and books.count() is executed, the results may not correlate with each other.

No - sometimes later count() also returns 0.