Skip to content
Advertisement

Empty dataframe when filtering

I have a dataframe that looks like this:

enter image description here

Now I’d like to filter like this:

df1.loc[df1['PZAE'] == 'HAE']

However, I am getting an empty dataframe. enter image description here

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

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement