Some Important Operators:

Membership operators in Python for Data Science –

These operators are used for validating membership of a value. The membership test is done in a sequence, for example lists, tuples or strings.

Some of the membership operators are as follows:

  1. in operator – It is used for checking whether the existence of a value is sequential or not. It returns TRUE if the value found is in the specified sequence. In other cases, it returns FALSE.

python data science

Let’s look at the above example but this time without the use of ‘in’ operator.

data science

  1. not in operator – As the name suggests, it returns TRUE if it is unable to find a variable in the defined sequence. In other cases, it returns FALSE.

Identity Operators:

These operators are useful when we have to determine whether or not a value belongs to a certain class or type. It is used to find out the type of data contained in a certain variable.

  1. is operator – Returns TRUE if both the variables refer to the same object otherwise returns FALSE.


  1. is not operator – As the name suggests, it is the opposite of ‘is’ operator. If the variables refer to different objects, it returns TRUE, otherwise returns FALSE.

python for data science

If you want to learn more about operators in python for data science then you can check this and this as well.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.