I have a dataframe that looks like this:
Now I’d like to filter like this:
df1.loc[df1['PZAE'] == 'HAE']
However, I am getting an empty dataframe.
What am I doing wrong here?
Advertisement
Answer
Try df1.loc[df1['PZAE']=="'HAE'"]
Details :
the column 'PZAE'
contains str
starting and finishing by '
that’s why you have to include them in the condition