[Solved] How do I filter an empty DataFrame and still keep the columns of that DataFrame?

[ad_1]

df2 = df1[df1.B.apply(lambda x:x == 1).astype(bool)]

All other answers are missing the point (except for Wen’s, which is an ok alternative)

1

[ad_2]

solved How do I filter an empty DataFrame and still keep the columns of that DataFrame?