filter columns where index value is 0

Question:

In a given dataframe:
enter image description here

I would like to filter those columns where values are 0 for index std.

Asked By: Kas

||

Answers:

Use DataFrame.loc in boolean indexing – first select index std, compare and select all rows by : with filtered mask:

df1 = df.loc[:, df.loc['std'].eq(0)]
Answered By: jezrael

You can filter the std column for values that are equal to zero.

This could work: df = num_df.loc[num_df['std'] == 0]

Answered By: JohnyCapo
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.