数据挖掘算法原理与实践:数据预处理
2021/4/12 12:25:10
本文主要是介绍数据挖掘算法原理与实践:数据预处理,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
第1关:数据集介绍
import pandas as pd f500 = pd.read_csv('f500.csv',index_col=0) f500.index.name = None # 请在此添加代码,分别打印f500的类型和形状大小 #********** Begin **********# print(type(f500)) print(f500.shape) #********** End **********#
第5关:值统计的方法
import pandas as pd f500 = pd.read_csv('f500.csv',index_col=0) f500.index.name = None f500_sel = f500.iloc[[0,1,2,3,4,8]] # 请在此添加代码 #********** Begin **********# countries = f500_sel["country"] country_counts = countries.value_counts() print(countries) print(country_counts) #********** End **********#
第6关:通过标签从series中选择项
import pandas as pd f500 = pd.read_csv('f500.csv',index_col=0) f500.index.name = None countries = f500['country'] countries_counts = countries.value_counts() # 请在此添加代码 #********** Begin **********# india = countries_counts["India"] north_america = countries_counts.loc[["USA","Canada","Mexico"]] print(india) print(north_america) #********** End **********# #********** End **********#
第7关:综合挑战
#i 在educoder.net上测试不了 import pandas as pd f500 = pd.read_csv('f500.csv',index_col=0) f500.index.name = None #i------------- countries = f500['country'] countries_counts = countries.value_counts() #india = countries_counts["India"] #north_america = countries_counts.loc[["USA","Canada","Mexico"]] # 请在此添加代码 #********** Begin **********# big_movers = f500.loc[["Aviva","HP","JD.com","BHP Billiton"],["rank","previous_rank"]] print(big_movers) bottom_companies = f500.loc["National Grid":"AutoNation",["rank","sector","country"]] print(bottom_companies) #********** End **********#
这篇关于数据挖掘算法原理与实践:数据预处理的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23Springboot应用的多环境打包入门
- 2024-11-23Springboot应用的生产发布入门教程
- 2024-11-23Python编程入门指南
- 2024-11-23Java创业入门:从零开始的编程之旅
- 2024-11-23Java创业入门:新手必读的Java编程与创业指南
- 2024-11-23Java对接阿里云智能语音服务入门详解
- 2024-11-23Java对接阿里云智能语音服务入门教程
- 2024-11-23JAVA对接阿里云智能语音服务入门教程
- 2024-11-23Java副业入门:初学者的简单教程
- 2024-11-23JAVA副业入门:初学者的实战指南