I need to filter the datatable Column C contains and, with column b is empty
Example : Df1
ColumnA ColumnB ColumnC
1 and
2 note and
3 or
4 and
result df2
ColumnA ColumnB ColumnC
1 and
4 and
CodePudding user response:
I am assuming that you are working with pandas dataframe. If this is the case, then you can do Df1.loc[(Df1['ColumnB'].isnull()) & (Df1['ColumnC'] == 'and')]
If your "empty" cell means blank-space, i.e., ""
; then you should do Df1.loc[(Df1['ColumnB'] == "") & (Df1['ColumnC'] == 'and')]