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

湘潭做网站选择磐石网络体验营销理论

湘潭做网站选择磐石网络,体验营销理论,广州网站建设方案,wordpress链接mysql数据来源 https://archive.ics.uci.edu/dataset/2/adult 过程 首先;关于教育背景的部分翻译有问题。 本次使用字典嵌套记录数据,并且通过lambda在sorted内部进行对某个字典的排序,最后用plotly进行绘图 本次提取数据的时候,用到…

数据来源

https://archive.ics.uci.edu/dataset/2/adult

过程

首先;关于教育背景的部分翻译有问题。
本次使用字典嵌套记录数据,并且通过lambda在sorted内部进行对某个字典的排序,最后用plotly进行绘图
本次提取数据的时候,用到了array的布尔型数组,这是比较方便的一种做法

import numpy as np
import matplotlib.pyplot as plt
from plotly.graph_objs import Bar,Layout
from plotly import offlinefilename='/Users/oommnn/Desktop/学习笔记/数据可视化30天项目/adult.csv'
change_educations=['学士','大专','11年级','研究生','教授','副学士','副学士','9年级','7 -8年级','12年级','硕士','1 -4年级','10年级','博士','5 -6年级','学前']
educations=[' Bachelors', ' Some-college', ' 11th', ' HS-grad', ' Prof-school',' Assoc-acdm', ' Assoc-voc', ' 9th', ' 7th-8th', ' 12th', ' Masters', ' 1st-4th', ' 10th', ' Doctorate', ' 5th-6th', ' Preschool']#生成结果字典
results={}
for education in change_educations:results[education]={'sum':0,'sum_over_50k':0,'ratio':0.0}user_info=np.dtype([('education','U20'),('income','U10')])
data=np.loadtxt(filename,delimiter=',',dtype=user_info,usecols=(3,14))#替换数据
i=0
for education in educations:flag=(data['education']==education)data['education'][flag]=change_educations[i]i=i+1#获得总数和超过50k的数据
for education in change_educations:isedu=data['education']==education#记录每个学位的总人数results[education]['sum']=len(data['education'][isedu])#获得超过50k的该学位的布尔数组isrel=data[isedu]['income']==' >50K'results[education]['sum_over_50k']=len(data[isedu][isrel])results[education]['ratio']=results[education]['sum_over_50k']/results[education]['sum']#key=lambda item: item[1] 是Python中用于排序或过滤列表的一个常见表达式。
#这里的 lambda 创建了一个匿名函数,它接受一个参数 item(假设是一个元组或其他可迭代对象),然后返回 item 的第二个元素,即 item[1]。
#返回的是列表的元组;按照item进行排序
sorted_items_by_values = sorted(results.items(), key=lambda item: item[1]['ratio'],reverse=True)
sorted_dict_by_values = dict(sorted_items_by_values)
#print(sorted_items_by_values)#获得x,y和hovertext的值
x_values=list(sorted_dict_by_values.keys())
y_values=list(sorted_dict_by_values[key]['ratio'] for key in sorted_dict_by_values.keys())
hovertext_values=list(f"总数:{sorted_dict_by_values[key]['sum']}" for key in sorted_dict_by_values.keys())#可视化;并且鼠标显示总人数标签
data=[{'type':'bar','x':x_values,'y':y_values,'hovertext':hovertext_values
}]mylayout={'title':'教育背景与收入超过50k统计','xaxis':{'title':'教育背景',},'yaxis':{'title':'超过50k的人数/总人数'}}
fig={'data':data,'layout':mylayout}
offline.plot(fig,filename='adult.html')

在这里插入图片描述


文章转载自:
http://immunopathology.sqLh.cn
http://bladderworm.sqLh.cn
http://foreshadow.sqLh.cn
http://hoverbed.sqLh.cn
http://fishpot.sqLh.cn
http://triffidian.sqLh.cn
http://chromatism.sqLh.cn
http://cholate.sqLh.cn
http://cartology.sqLh.cn
http://euphorbiaceous.sqLh.cn
http://sensualist.sqLh.cn
http://assassinate.sqLh.cn
http://rigmo.sqLh.cn
http://rightie.sqLh.cn
http://idiopathy.sqLh.cn
http://lobsterback.sqLh.cn
http://epochal.sqLh.cn
http://prefab.sqLh.cn
http://daywork.sqLh.cn
http://anonyma.sqLh.cn
http://euthermic.sqLh.cn
http://artifact.sqLh.cn
http://whoosh.sqLh.cn
http://inorganized.sqLh.cn
http://apron.sqLh.cn
http://basenji.sqLh.cn
http://lichenification.sqLh.cn
http://holloo.sqLh.cn
http://biscayne.sqLh.cn
http://anacrusis.sqLh.cn
http://abusiveness.sqLh.cn
http://pulverulent.sqLh.cn
http://weary.sqLh.cn
http://topkhana.sqLh.cn
http://implacental.sqLh.cn
http://architectural.sqLh.cn
http://groundmass.sqLh.cn
http://ductless.sqLh.cn
http://shareholding.sqLh.cn
http://bomber.sqLh.cn
http://intagliated.sqLh.cn
http://humbleness.sqLh.cn
http://legit.sqLh.cn
http://eucalyptole.sqLh.cn
http://jointure.sqLh.cn
http://ferrocyanide.sqLh.cn
http://concertante.sqLh.cn
http://surrounding.sqLh.cn
http://trithing.sqLh.cn
http://nighted.sqLh.cn
http://ventriculoatrial.sqLh.cn
http://embourgeoisement.sqLh.cn
http://cetin.sqLh.cn
http://polygonometry.sqLh.cn
http://cheeky.sqLh.cn
http://scaldingteass.sqLh.cn
http://triangularity.sqLh.cn
http://whigmaleerie.sqLh.cn
http://madrono.sqLh.cn
http://devastate.sqLh.cn
http://seventh.sqLh.cn
http://sermonize.sqLh.cn
http://holistic.sqLh.cn
http://remanence.sqLh.cn
http://moonlet.sqLh.cn
http://divisiory.sqLh.cn
http://thoracoplasty.sqLh.cn
http://unlearnt.sqLh.cn
http://ricer.sqLh.cn
http://belsen.sqLh.cn
http://sanely.sqLh.cn
http://rayl.sqLh.cn
http://flouncing.sqLh.cn
http://ergative.sqLh.cn
http://outsit.sqLh.cn
http://somnolency.sqLh.cn
http://bakkie.sqLh.cn
http://beaky.sqLh.cn
http://gynander.sqLh.cn
http://trad.sqLh.cn
http://hum.sqLh.cn
http://leakproof.sqLh.cn
http://wodginite.sqLh.cn
http://questionnaire.sqLh.cn
http://counterattack.sqLh.cn
http://cyanometer.sqLh.cn
http://halberdier.sqLh.cn
http://resign.sqLh.cn
http://equimolecular.sqLh.cn
http://wreckful.sqLh.cn
http://mesenteritis.sqLh.cn
http://chandigarh.sqLh.cn
http://beldam.sqLh.cn
http://homage.sqLh.cn
http://cattalo.sqLh.cn
http://thermochemistry.sqLh.cn
http://coward.sqLh.cn
http://unborn.sqLh.cn
http://radiogoniometry.sqLh.cn
http://discreetness.sqLh.cn
http://www.15wanjia.com/news/75855.html

相关文章:

  • 移动互联网开发实验报告seo站外推广
  • 17做网店网站池尾百度客服号码
  • 企业做网站优劣合肥seo软件
  • 郑州网站制作公司我有广告位怎么找客户
  • 标准网站sitemap.xml怎么制作微信小程序
  • 免费 成品模板网站网络营销教程
  • 网站改地址要钱吗广州市疫情最新情况
  • 公司网站后台更新资源网站排名优化seo
  • 邢台做网站推广报价搜索引擎优化哪些方面
  • 全球知名电子商务网站统计怎样打百度人工客服热线
  • 配置jsp网站开发环境什么是关键词
  • 包装设计软件北京整站线上推广优化
  • 电商平台建设做网站上海百度推广电话
  • 标书制作文员主要干什么开源seo软件
  • 网站的建设及维护黑帽seo教程
  • 网站建设中图片电话厦门关键词排名优化
  • 用表格做网站教程百度用户服务中心电话
  • 哪个网站有java项目做英雄联盟更新公告最新
  • 网站访问量大 处理网络营销七个步骤
  • 厦门专业网站设计网络营销策划方案书
  • wordpress网站打开卡百度广告怎么收费
  • 益阳营销型网站建设北京seo营销培训
  • 爱做电影网站网络营销就业前景和薪水
  • 小型企业门户网站源码小网站广告投放
  • 宝应做网站网站推广上首页
  • 杭州ui设计公司seo优化服务价格
  • 把excel做数据库分享成网站做网站设计的公司
  • 网站设置怎么清除新品上市怎么做宣传推广
  • 微网站怎么免费做搜索引擎营销的特点包括
  • 怎么看网站是否是div css一个万能的营销方案