objects.filter multiple conditions django code example
Example 1: query with condition django
from django.db.models import Q
User.objects.filter(Q(income__gte=5000) | Q(income__isnull=True))
Example 2: filter dataframe multiple conditions
# when you wrap conditions in parantheses, you give order
# you do those in brackets first before 'and'
# AND
movies[(movies.duration >= 200) & (movies.genre == 'Drama')]