# Create a new column in a dataframe with pandas in python such that the new column should be True/False format based on existed column

I was trying to create a new column to a dataframe such that the new column should have the format as True/False based on some pattern.

My dataframe:

df = pd.DataFrame([[1,16],[21,3],[0.9,56]])
df.columns=['A','B']
df.index = ['1','2','3']
df


I want to create a new column such that if A > 2 and B < 30 will have value as True in a new column, otherwise should have value as False.

I tried to use np.where to get the new column but I am not sure how can I get values as True or False.

You could use np.where, but just using a series comparison should work as well:
df["col"] = (df["A"] > 2) & (df["B"] < 30)

Well, obviously the solution using a series comparison published by @Oxbowerce is the best option because it is not needed to import a big tool like Numpy for doing this simple task. However, if someone is asking for the solution that uses numpy.where, this could be as follow:
import numpy as np