当前位置: 首页 > news >正文

网站开发脚本语言和数据库好用的wordpress编辑器

网站开发脚本语言和数据库,好用的wordpress编辑器,网站可以做无形资产,人人开发接单官网数据截图: 数据下载地址#xff1a;链接#xff1a;https://pan.baidu.com/s/1dGHwAC5 密码#xff1a;nfd2 该数据包含了2006年-2015年10年间亚洲地区人口数量数据#xff0c;共10行50列数据。我们需要使用Numpy完成如下数据任务: 计算2015年各个国家人口数据计算朝鲜历… 数据截图: 数据下载地址链接https://pan.baidu.com/s/1dGHwAC5 密码nfd2 该数据包含了2006年-2015年10年间亚洲地区人口数量数据共10行50列数据。我们需要使用Numpy完成如下数据任务: 计算2015年各个国家人口数据计算朝鲜历史各个时期人口数据计算缅甸2014年的人口数据计算每一个国家历史平均人口数据计算亚洲2015年总人口及平均人口计算印度、柬埔寨、阿富汗在2011、2012、2013年总人口及平均人口计算任意两个国家之间的人口差数据计算2012年亚洲人口数量排名前10的国家import numpy as np import numpy as np In [42]:#国家索引 country_index np.array(open(亚洲国家20年人口数据-gb2312.csv).readline()[:-1].split(,) )#读取人口数据 p_data np.genfromtxt(亚洲国家20年人口数据-gb2312.csv,delimiter ,,skip_header 1,dtype np.str )#时间索引 time_index p_data[:,0]#数据行索引 time_index #国家索引 country_index np.array(open(亚洲国家20年人口数据-gb2312.csv).readline()[:-1].split(,) ) ​ #读取人口数据 p_data np.genfromtxt(亚洲国家20年人口数据-gb2312.csv,delimiter ,,skip_header 1,dtype np.str ) ​ #时间索引 time_index p_data[:,0] ​ #数据行索引 time_index Out[42]: array([2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008,2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000,1999, 1998, 1997, 1996],dtypeU10) In [43]:#数据索引 country_index Out[43]: array([时间, 阿富汗, 巴林, 孟加拉国, 不丹, 文莱, 缅甸, 柬埔寨, 塞浦路斯, 朝鲜,中国香港, 印度, 印度尼西亚, 伊朗, 伊拉克, 以色列, 日本, 约旦, 科威特, 老挝,黎巴嫩, 中国澳门, 马来西亚, 马尔代夫, 蒙古, 尼泊尔, 阿曼, 巴基斯坦, 巴勒斯坦,菲律宾, 卡塔尔, 沙特阿拉伯, 新加坡, 韩国, 斯里兰卡, 叙利亚, 泰国, 土耳其,阿联酋, 也门, 越南, 中国台湾, 东帝汶, 哈萨克斯坦, 吉尔吉斯斯坦, 塔吉克斯坦,土库曼斯坦, 乌兹别克斯坦, 马恩岛, 约旦河西岸和加沙],dtypeU8) 1.计算2015年各个国家人口数据 In [44]:year 2015 ​ #获取year年所有国家人口数据 p_by_year p_data[time_index year] ​ #取前国家显示 p_by_year p_by_year[0] ​ #给数据添加国家名称 print(%s年各个国家人口数据%year) print(--------------------------) ​ for country_name,country_data in zip(country_index[1:],p_by_year[1:]):print(%s人口为:\t%s%(country_name,country_data)) 2015年各个国家人口数据 -------------------------- 阿富汗人口为: 32526562 巴林人口为: 1377237 孟加拉国人口为: 160995642 不丹人口为: 774830 文莱人口为: 423188 缅甸人口为: 53897154 柬埔寨人口为: 15577899 塞浦路斯人口为: 1165300 朝鲜人口为: 25155317 中国香港人口为: 7305700 印度人口为: 1311050527 印度尼西亚人口为: 257563815 伊朗人口为: 79109272 伊拉克人口为: 36423395 以色列人口为: 8380100 日本人口为: 126958472 约旦人口为: 7594547 科威特人口为: 3892115 老挝人口为: 6802023 黎巴嫩人口为: 5850743 中国澳门人口为: 587606 马来西亚人口为: 30331007 马尔代夫人口为: 409163 蒙古人口为: 2959134 尼泊尔人口为: 28513700 阿曼人口为: 4490541 巴基斯坦人口为: 188924874 巴勒斯坦人口为: 菲律宾人口为: 100699395 卡塔尔人口为: 2235355 沙特阿拉伯人口为: 31540372 新加坡人口为: 5535002 韩国人口为: 50617045 斯里兰卡人口为: 20966000 叙利亚人口为: 18502413 泰国人口为: 67959359 土耳其人口为: 78665830 阿联酋人口为: 9156963 也门人口为: 26832215 越南人口为: 91713300 中国台湾人口为: 东帝汶人口为: 1184765 哈萨克斯坦人口为: 17544126 吉尔吉斯斯坦人口为: 5956900 塔吉克斯坦人口为: 8481855 土库曼斯坦人口为: 5373502 乌兹别克斯坦人口为: 31298900 马恩岛人口为: 87780 约旦河西岸和加沙人口为: 4422143 2.计算朝鲜历史各个时期人口数据 In [45]:country 朝鲜 #先查找朝鲜在数组的索引 country_where np.argwhere(country_index country)[0][0] ​ #按照索引计算人口数据 print(%s各个年份人口数据%country) print() ​ for data in zip(time_index,p_data[:,country_where]):print(data)print() 朝鲜各个年份人口数据(2015, 25155317) (2014, 25026772) (2013, 24895705) (2012, 24763353) (2011, 24631359) (2010, 24500506) (2009, 24371806) (2008, 24243829) (2007, 24111945) (2006, 23969897) (2005, 23813324) (2004, 23639296) (2003, 23449173) (2002, 23248053) (2001, 23043441) (2000, 22840218) (1999, 22641747) (1998, 22444986) (1997, 22240826) (1996, 22016510)3.计算缅甸2014年人口数据 In [46]:country 缅甸 year 2014 ​ country_data p_data[time_indexyear][0][np.argwhere(country_index country)[0][0]] ​ print(%s在%s年人口数据为%s%(country,year,country_data)) 缅甸在2014年人口数据为53437159 4.计算每一个国家历史平均人口数据 In [47]:#去除第一行时间数据 every_country_data np.delete(p_data.T,0,axis0) ​ #处理数据中的空值为0 every_country_data np.where(every_country_data,0,every_country_data).astype(np.int32) ​ ​ #计算每一个国家平均人口 avg_data np.mean(every_country_data,axis1).astype(np.int32) ​ print(各个国家历史平均人口数据) print() ​ #各个国家名称 country_name country_index[1:] ​ for country_name,data in zip(country_index[1:],avg_data):print(%s国家历史平均人口数据%s%(country_name,data)) ​ 各个国家历史平均人口数据阿富汗国家历史平均人口数据24566255 巴林国家历史平均人口数据961489 孟加拉国国家历史平均人口数据142511842 不丹国家历史平均人口数据650117 文莱国家历史平均人口数据364592 缅甸国家历史平均人口数据49912636 柬埔寨国家历史平均人口数据13384934 塞浦路斯国家历史平均人口数据1030891 朝鲜国家历史平均人口数据23752403 中国香港国家历史平均人口数据6865960 印度国家历史平均人口数据1150202417 印度尼西亚国家历史平均人口数据228174990 伊朗国家历史平均人口数据70450024 伊拉克国家历史平均人口数据27799113 以色列国家历史平均人口数据7016715 日本国家历史平均人口数据127318832 约旦国家历史平均人口数据5723731 科威特国家历史平均人口数据2545149 老挝国家历史平均人口数据5842897 黎巴嫩国家历史平均人口数据4085650 中国澳门国家历史平均人口数据487277 马来西亚国家历史平均人口数据25966300 马尔代夫国家历史平均人口数据331258 蒙古国家历史平均人口数据2579777 尼泊尔国家历史平均人口数据25465307 阿曼国家历史平均人口数据2798350 巴基斯坦国家历史平均人口数据155928633 巴勒斯坦国家历史平均人口数据0 菲律宾国家历史平均人口数据86371329 卡塔尔国家历史平均人口数据1179044 沙特阿拉伯国家历史平均人口数据25157752 新加坡国家历史平均人口数据4551772 韩国国家历史平均人口数据48298055 斯里兰卡国家历史平均人口数据19483750 叙利亚国家历史平均人口数据18060010 泰国国家历史平均人口数据64970255 土耳其国家历史平均人口数据68492236 阿联酋国家历史平均人口数据5575669 也门国家历史平均人口数据21019667 越南国家历史平均人口数据82703935 中国台湾国家历史平均人口数据0 东帝汶国家历史平均人口数据984978 哈萨克斯坦国家历史平均人口数据15734151 吉尔吉斯斯坦国家历史平均人口数据5217475 塔吉克斯坦国家历史平均人口数据6965083 土库曼斯坦国家历史平均人口数据4799654 乌兹别克斯坦国家历史平均人口数据26807230 马恩岛国家历史平均人口数据80731 约旦河西岸和加沙国家历史平均人口数据3424896 5.计算亚洲2015年总人口以及平均数 In [48]:year 2015 ​ #2015年亚洲各个国家人口数量 every_country_data p_data[time_index year] ​ #去除第一条时间数据 every_country_data np.delete(p_data.T,0,axis0) ​ #计算数据中的缺失值并将数据类型转换为数字类型 every_country_data np.where(every_country_data,0,every_country_data).astype(np.int32) ​ #计算平均值 avg_data np.mean(every_country_data) ​ #计算总人口 total_data np.sum(every_country_data) ​ print(亚洲%s年总人口数据%s,平均人后数据是%s%(year,total_data,avg_data)) 亚洲2015年总人口数据792297067,平均人后数据是53399902.6724 6. 计算印度、柬埔寨、阿富汗在2011、2012、2013年总人口及平均人口 In [54]:contry [印度,柬埔寨,阿富汗] ​ year [2011,2012,2013] #先获得所有国家11/12/13年的人口数据 all_country_data_by_year [] for y in year:all_country_data_by_year.append(p_data[time_index y][0]) ​ # #计算国家所对应的列索引 indexes [] for c in contry:indexes.append(np.argwhere(country_index c)[0][0]) ​ # #计算指定国家的数据 all_country_data_by_year np.array(all_country_data_by_year) all_country_data_by_year all_country_data_by_year[:,indexes] ​ # #处理数据中可能存在的缺失值 all_country_data_by_year np.where(all_country_data_by_year ,0,all_country_data_by_year) ​ all_country_data_by_year all_country_data_by_year.astype(np.int32) # #计算每一年人口总和 p_sum all_country_data_by_year.sum(axis1) ​ # #计算每一年人口平均数 p_mean all_country_data_by_year.mean(axis1) ​ for y,s,m in zip(year,p_sum,p_mean):print(%s年%s国家的人口总和为:%s, 平均人口为:%s % (y, ,.join(contry), s, m)) 2011年印度,柬埔寨,阿富汗国家的人口总和为:1290848277, 平均人口为:430282759.0 2012年印度,柬埔寨,阿富汗国家的人口总和为:1308148697, 平均人口为:436049565.667 2013年印度,柬埔寨,阿富汗国家的人口总和为:1325259938, 平均人口为:441753312.667 7.计算任意两个国家之间的人口差数据 In [57]:country1 柬埔寨 country2 越南 year 2013 ​ #计算2015年人口数据 data_2015 p_data[time_index year] data_2015 np.where(data_2015 ,0,data_2015).astype(np.int32) ​ #获得两个国家的人口数据 country1_data data_2015.T[country_index country1][0][0] country2_data data_2015.T[country_index country2][0][0] ​ print(%s和%s的人口差是%s !%(country1,country2,np.abs(country1_data-country2_data))) 柬埔寨和越南的人口差是74680936 ! 8.计算2012年亚洲人口数量排名前10的国家 In [60]:#计算2012年亚洲人口数据 year 2012 ​ #获得2012年数据 data_2012 p_data[time_index year][0][1:] #处理缺失值 data_2012 np.where(data_2012 ,0,data_2012) #数据转换为数字类型 data_2012 data_2012.astype(np.int32) ​ #对结果排序 sorted_index np.argsort(data_2012) ​ #人口数量前10的国家 ret_data data_2012[sorted_index][::-1][10:] ret_index country_index[1:][sorted_index][::-1][:10] ​ #输出结果 for a,b in zip(ret_index,ret_data):print(国家%s人口%s%(a,b)) 国家印度人口52543841 国家印度尼西亚人口50004441 国家巴基斯坦人口32957622 国家孟加拉国人口29774500 国家日本人口29726803 国家菲律宾人口29496047 国家越南人口29021940 国家伊朗人口27500515 国家土耳其人口24882792 国家泰国人口24763353
http://www.pierceye.com/news/451416/

相关文章:

  • 江苏建设厅网站查询国外网站推荐
  • 一个网站多久能做完湖南营销网站建设
  • sql网站开发徐州市住房建设局网站
  • 做网站的代码大学生网页设计心得体会
  • 浩方网络网站建设海安环评在哪个网站做
  • 吉林省建设厅证件查询网站网站不备案什么意思
  • 怎么查wordpress主题鞍山seo优化
  • 文字网站和图片网站哪个难做大城县建设局网站
  • 网站的二级目录是什么怎么把网站和域名绑定
  • 佛山营销网站建设wordpress请求超时
  • wordpress今天更新文章数漳州网站优化
  • 开发公司房产销售合同中必须明确哪些事项?seo网站推广全程实例
  • asp网站水印支除网络营销与市场营销的关系
  • 方圆网 网站建设wordpress 首页 不显示归档
  • 网站关键词怎么快速上排名wordpress极慢
  • 摄影网站建站wordpress怎么改密码
  • 旅游网站制作过程百度收录查询入口
  • 简述企业网站建设的流程网站建设的需求分析报告
  • 做网络课程的网站聚美优品网站建设分析
  • 网站建设公司简介wordpress注册按钮
  • 网站的栏目建设在哪里惠州网
  • 免费建站模板哪个好核酸造假7人枪毙视频
  • 一手房哪个网站做信息效果好微信小程序打不开
  • 建设网站图片素材包头怎样做网站
  • 网站内容建设与管理90设计app下载
  • 怎么做优惠卷网站公司做网站大概多少钱
  • 哪些网站是单页面应用程序在线做网站流程
  • 公司网站设计维护官方网站建设需要做哪些东西
  • 网站被k还能不能在百度做推广wordpress主题网址导航葬爱
  • 成都网站制作和建设辽阳北京网站建设