<jupyter_start><jupyter_text>Method 1<jupyter_code>#Select 2 SalesReps based on SQL's "in" - Filter for ['Amy','Bob']

#Select 2 SalesReps based on SQL's "not in"<jupyter_output><empty_output><jupyter_text>Method 2<jupyter_code>#isin
#Create a list of SalesRep's you want to select. To select then use 'isin'
filter_SalesRep = ['Amy','Bob']

#not in
#Create a list of SalesRep's you want to select. To select then use 'isin' along with the '~'
filter_SalesRep = ['Amy','Bob']<jupyter_output><empty_output><jupyter_text>Method 3 - Multiple Criteria<jupyter_code>#in
#You can ue 2 filters using & operator and provide seperate list for each column - use '&'
filter_SalesRep = ['Amy','Bob']
filter_Region = ['North', 'West']

#in & not in
#Just use the '~' in front of column you don't want values from
filter_SalesRep = ['Amy','Bob']
filter_Region = ['North', 'West']<jupyter_output><empty_output><jupyter_text>Method 4 - Using Numpy (Faster)<jupyter_code>#in
filter_SalesRep = ['Amy','Bob']

#not in
filter_SalesRep = ['Amy','Bob']<jupyter_output><empty_output><jupyter_text>Method 5 - Using List Comprehensions (Much Faster)<jupyter_code>#in
filter_SalesRep = ['Amy','Bob']

#not in
filter_SalesRep = ['Amy','Bob']<jupyter_output><empty_output><jupyter_text>Method 6 - Select Rows based on wherever the value is present in any Column<jupyter_code>games = pd.read_csv('games.csv')
games
games[['Game2','Game4']]
criteria = ['Yes']<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14256339958875944, 'fraction_numerical': 0.0075394105551747775, 'mean_word_length': 7.202247191011236, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '418404', 'license': 'MIT', 'n_tokens_mistral': 571, 'n_tokens_neox': 524, 'n_words': 140, 'path': 'Python Pandas Smart Tricks/5_Filter_Dataframe_using_in_notin_like_SQL_Working.ipynb', 'repo_name': 'KunaalNaik/YT_Python_Pandas', 'size': '1459'}