#NEWLINE# @ staticmethod #NEWLINE# def apply_filters( df , filters ) : #NEWLINE# #INDENT# 'Basic filtering for a dataframe.' #NEWLINE# idx = pd . Series ( ( [ True ] * df . shape [ 0 ] ) ) #NEWLINE# for ( k , v ) in list ( filters . items ( ) ) : #NEWLINE# #INDENT# if ( k not in df . columns ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# idx &= ( df [ k ] == v ) #NEWLINE# #UNINDENT# return df . loc [ idx ]