Python Scikit learn: Get observations of each species from iris data
Python Machine learning Iris Basic: Exercise-6 with Solution
Write a Python program to get observations of each species (setosa, versicolor, virginica) from iris data.
import pandas as pd data = pd.read_csv("iris.csv") print("Observations of each species:") print(data['Species'].value_counts())
Observations of each species: Iris-versicolor 50 Iris-virginica 50 Iris-setosa 50 Name: Species, dtype: int64
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to get observations of each species (setosa, versicolor, virginica) from iris data.
Next: Write a Python program to drop Id column from a given Dataframe and print the modified part. Call iris.csv to create the Dataframe.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework