Computer scienceData scienceInstrumentsPandasData analysis with pandas

Summarizing categorical columns

Rock it

Report a typo

For now, when you go to the IDE tab, you can solve this problem only via Pycharm. We are sorry for the inconvenience, we will fix this as soon as we can. If you prefer to solve the problem via a different IDE, you should open it manually and then copy the solution to the website.

You are working with a DataFrame called df_rock that contains sonar signals from two object classes: rocks and mines. In the first five columns, you can see the wavelengths that the sonar received from different angles.

Load the given data as a pandas DataFrame, then check how many rows are labeled with "R".

Conditional selection ["R"] may help you here.

Sample Input 1:

,0_deg,60_deg,90_deg,180_deg,240_deg,labels
0,0.740204,0.981484,0.605161,0.67712,0.927914,M
1,0.788051,0.68378,0.504151,0.713523,0.690165,R
2,0.744574,0.668011,0.564707,0.804288,0.713663,R
3,0.560475,0.487072,0.103085,0.668011,0.805988,R

Sample Output 1:

3
Write code in your IDE to process the text file and display the results below
___

Create a free account to access the full topic