stefanuddenberg
10/18/2019 - 3:32 AM

Pandas -- Filter data with query

# importing pandas package 
import pandas as pd 
  
# making data frame from csv file  
data = pd.read_csv("employees.csv") 
  
# replacing blank spaces with '_'  
data.columns =[column.replace(" ", "_") for column in data.columns] 
  
# filtering with query method 
data.query('Senior_Management == True 
            and Gender =="Male" and Team =="Marketing" 
            and First_Name =="Johnny"', inplace = True) 
  
# display 
data