Code Sample, a copy-pastable example if possible

# Your code here
In [61]: df_null = pd.DataFrame(columns=['a','b','c'])

In [62]: df_null
Out[62]:
Empty DataFrame
Columns: [a, b, c]
Index: []

In [63]: ind1 = df_null.a == '0'
In [65]: ind2 = df_null.a.apply(lambda x: x == '0')

In [66]: df_null[ind1]
Out[66]:
Empty DataFrame
Columns: [a, b, c]
Index: []

In [67]: df_null[ind2]
Out[67]:
Empty DataFrame
Columns: []
Index: []

Problem description

Would expect both indices to result in the same empty dataframe with the structure of the columns preserved.

Expected Output

Empty DataFrame
Columns: [a, b, c]
Index: []

for both indices

Output of pd.show_versions()

[paste the output of ``pd.show_versions()`` here below this line] INSTALLED VERSIONS ------------------ commit: None python: 3.6.3.final.0 python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 79 Stepping 1, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None pandas: 0.20.3 pytest: 3.2.1 pip: 9.0.1 setuptools: 36.5.0.post20170921 Cython: 0.26.1 numpy: 1.13.3 scipy: 0.19.1 xarray: None IPython: 6.1.0 sphinx: 1.6.3 patsy: 0.4.1 dateutil: 2.6.1 pytz: 2017.2 blosc: None bottleneck: 1.2.1 tables: 3.4.2 numexpr: 2.6.2 feather: None matplotlib: 2.1.0 openpyxl: 2.4.8 xlrd: 1.1.0 xlwt: 1.3.0 xlsxwriter: 1.0.2 lxml: 4.1.0 bs4: 4.6.0 html5lib: 0.999999999 sqlalchemy: 1.1.13 pymysql: None psycopg2: None jinja2: 2.9.6 s3fs: None pandas_gbq: None pandas_datareader: None

Comment From: jreback

These are 2 different results. Using .apply for this purpose is quite non-idiomatic. [4] is a boolean indexer, while [3] is just an empty selection.

In [3]: df_null.a.apply(lambda x: x == '0')
Out[3]: Series([], Name: a, dtype: object)

In [4]: df_null.a == '0'
Out[4]: Series([], Name: a, dtype: bool)

Since .loc works correctly I guess fixing [] would be ok.

In [8]: df_null.loc[indexer]
Out[8]: 
Empty DataFrame
Columns: [a, b, c]
Index: []

Comment From: phofl

As discussed in #37772 this is expected