Math, asked by prarthana3112, 7 months ago


A
too each incorset Sun He does
Sums and obtains 32
masks The number of corta
Sum were,​

Answers

Answered by guptapreeti051181
1

Answer:

I have a df[n,f] eg,n rows x 35 features. The sum of all the features across each row is = 1.0. I am attempting to create a stacked bar chart by grouping all features which are not above a certain minimum average into a category "All Others." I am attempting to use a mask to accomplish this. Eg, if I set a threshold of 5%:

[In]

mask = (df.sum(axis = 0) > num_selected * 0.05).values

mask

[Out]

array([False, False, True, True, False, False, False, False, False,

False, False, True, False, False, False, False, False, False,

True, True, False, False, False, False, True, False, False,

False, False, False, False, False, False, False, False], dtype=bool)

My question is: given this mask, how can I group all the features which do not meet the criteria (eg, are 'false') into "All Others" and use that to create a stacked bar chart with all the other 'True' features?

Similar questions