Skip to content Skip to sidebar Skip to footer

Filter Pandas Columns Based On Row Condition

i have the following dataframe called df. x1 x2 x3 .... row1 12 3.4 5 ... row2 1 3 4 ... row3 True False True ... ... I want to display the colum

Solution 1:

iloc asks you to pass (list of) integers. Try loc:

df.loc[:,df.loc['row3']]

Post a Comment for "Filter Pandas Columns Based On Row Condition"