Skip to content

Instantly share code, notes, and snippets.

@arthuralvim
Created August 27, 2018 19:18
Show Gist options
  • Save arthuralvim/242aef56bfad5ac9592930b2468a62de to your computer and use it in GitHub Desktop.
Save arthuralvim/242aef56bfad5ac9592930b2468a62de to your computer and use it in GitHub Desktop.
import pandas as pd
d = {
'col1': [True, True, False, False, True, False],
'col2': [False, True, False, True, True, False],
'col3': [True, False, False, False, True, False],
'col4': [True, False, True, False, True, True],
'col5': ['T', 'T', 'L', 'L', 'T', 'L']
}
df = pd.DataFrame(data=d)
df[(df['col5'] == 'T') & (df['col1'])]
df[df['col5'] == 'T']
df[df['col1']]
df[~df['col3']]
df[(df['col5'] == 'T') & ((df['col1']) | (df['col3']))]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment