Answers for "python pandas in list"

0

python pandas in list

# Dataframe df column 'columnA' is any of the values 'value1', 'value2'
df[df['columnA'].isin(['value1', 'value2'])]['columnB']
# SQL equivalent:
SELECT columnB FROM df WHERE columnA IN ('value1', 'value2')
Posted by: Guest on July-20-2021

Python Answers by Framework

Browse Popular Code Answers by Language