How to access feature names?

QuestionsQuestions8 SkillsProDec, 10 2025
084

To access the feature names, you use the feature_names attribute of the iris object, just like you accessed iris.data and iris.target.

The current step guides you to do exactly that! You need to modify your main.py file to include:

from sklearn import datasets

# Load the Iris dataset
iris = datasets.load_iris()

# Print the feature names
print(iris.feature_names)

After updating your main.py with this code, run it from your terminal using python3 main.py. This will display a list of strings, which are the names of each feature!

0 Comments

no data
Be the first to share your comment!