Here is an example pandas DataFrame:
import pandas as pd
import numpy as np
data = {\"first_column\": [\"item1\", \"item2\", \"item3\", \"item4\", \"item5\"
Use &
to compound the conditions:
In [28]:
df['both'] = df['third_column'].ge(10) & df['third_column'].le(1000)
df
Out[28]:
first_column second_column third_column both
0 item1 cat1 5 False
1 item2 cat1 1 False
2 item3 cat1 8 False
3 item4 cat2 3 False
4 item5 cat2 731 True
5 item6 cat2 189 True
6 item7 cat2 9 False