Question: The Boolean arrays and masks notebook discusses combining Boolean arrays with Boolean operators & ( conceptually 'and' ) and ( conceptually ' or ' )

The Boolean arrays and masks notebook discusses combining Boolean arrays with Boolean operators & (conceptually 'and') and (conceptually 'or') and (conceptually 'not'). Study the examples there, especially the examples used on the Seattle rainfall data. Pay special attention to the use of parentheses, because using them correctly matters in solving the following problems.
Each of the following problems concerns finding a particular set of rows in the covertypes dataset. For each set do two things:
a. Construct a single Python expression which counts the number of rows in the set. b. Construct a single Python expression which returns all the rows of the covertype dataset that are in the set. (Note: not just the Boolean array, but the rows you get when use the Boolean array as a mask).
The rows in the covertype dataset which have a value greater than 300 for attribute 1.
The rows which have attribute 12(Note: this is a qualitative soil attribute).
The entire covertypes dataset excluding rows which belong either to covertype 3 or covertype 5.(Note: you will have to use two arrays data.data and data.target).
The rows which have attribute 12 but do not have either covertype 3 or covertype 5.
The rows which are not in covertype 3 or 5, have a value greater than 300 for attribute 1, and have attribute 12.
The Boolean arrays and masks notebook discusses

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!