鸢尾花实验数据(Python)

本文展示了如何使用Python的sklearn库加载鸢尾花数据集,并详细介绍了数据集的关键信息,包括数据集的描述、特征名、目标名、数据和目标的类型以及它们的形状。通过对前5行数据的展示,为后续的数据分析打下基础。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

鸢尾花实验数据

导入鸢尾花数据集

from sklearn.datasets import load_iris
iris_dataset=load_iris()

显示数据集的key

print("keys of iris_dataset:\n{}".format(iris_dataset.keys()))

鸢尾花数据集的列名(key)

查看数据集的DESCR列内容

print(iris_dataset['DESCR'][:193]+"\n...")

鸢尾花数据集descr列前193行的内容

查看目标名称

print("Target names:{}".format(iris_dataset['target_names']))

鸢尾花数据集的target 名称内容

查看特点名称

print("Feature names:\n{}".format(iris_dataset['feature_names']))
#sepal花萼  petal花瓣

鸢尾花数据集特征名称

查看鸢尾花数据集的类型

print("Type of data:{}".format(type(iris_dataset['data'])))

鸢尾花数据集数据类型

查看鸢尾花数据集的大小

print("Shape of data:{}".format(iris_dataset['data'].shape))

查看鸢尾花数据集的大小

查看鸢尾花数据集data列前5行内容

print("First five rows of data:\n{}".format(iris_dataset['data'][:5]))

鸢尾花数据集data列前五行内容

查看target的类型

print("Type of target:{}".format(type(iris_dataset['target'])))

鸢尾花数据集中target的类型

查看target的shape

print("Shape of target:{}".format(iris_dataset['target'].shape))

查看鸢尾花数据集target的形状

查看鸢尾花数据集target的内容

print("Target:\n{}".format(iris_dataset['target']))

查看鸢尾花数据集target中的内容

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

李少女_辣辣妹

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值