Why can I filter a df in one file, but cannot apply the same filter to the same df in another file?

Here is an example of a similar filter I can easily apply to a df (it contains almost one million rows):

df[‘Value’][df[‘Column 1’] == ‘Name 1’][df[‘Column 2’] == ‘Name 2’]

But when I try to apply the same filter to the same df, but in a different Jupyter Notebook file, it never stops loading the file - or put differently, Python does not finish the task I ask. In this specific file, Python only allows me to apply “half” of the filter above:

df[‘Value’][df[‘Column 1’] == ‘Name 1’]

When I try the complete filter, Python never finish the task.

Can anyone help me to understand why Python never finish to load a simple filter that was already used in a different Jupyter Notebook file?

Many thanks!

Maybe you want to use the “&” operator?


Hey Dennis! Thank you for your answer!

There is nothing wrong with the filter - I already used it in a different file.

The problem is that, in one specific Jupyter Notebook file, Python never stops loading it. It only works when I use one part of the filter.

“it never stops loading the file” - loading of which file never stops?

Hi Aivar! Sorry, I’m totally new at Python!

The file that never stops loading is the one which I’m trying to make the filter work - it works perfectly normal at another Jupyter Notebook file, with the exactly same dataframe, btw.