世界GDP数据可视化
各国GDP数据可视化 数据来自世界银行
导入资源包,如下:
Pandas, numpy, seaborn 和 matplotlib
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
导入数据
Country_GDP= pd.read_csv("Country_GDP.csv",sep=";")
df = pd.DataFrame(Country_GDP)
显示列名
Country_GDP.columns
典型数据处理
1.增加一列数据,显示从2013年到2018年各国GDP增加率
df['increaseRate2013-2018'] = (df["2018"] - df["2013"])/df["1990"] *100
2.按照'increaseRate2013-2018'列的升序显示数据,并将新值付给新的df
df = df.sort_values(by='increaseRate2013-2018',ascending=True)
3.如果在打印时,看到显示在屏幕上的数列数过少,可以使用pd.set_option('display.max_rows',20)来进行设置
pd.set_option('display.max_rows',20)
4.删除一些不需用用的行值 使用df['Country Name']找到Country Name列,并查找等于"World值得的列,找到这一列后,显示它的index. 最后使用df.drop删除
df=df.drop(df[df['Country Name']=="World"].index,axis=0)
df=df.drop(df[df['Country Name']=="High income"].index,axis=0)
df=df.drop(df[df['Country Name']=="OECD members"].index,axis=0)
df=df.drop(df[df['Country Name']=="Post-demographic dividend"].index,axis=0)
df=df.drop(df[df['Country Name']=="Europe & Central Asia"].index,axis=0)
df=df.drop(df[df['Country Name']=="European Union"].index,axis=0)
df=df.drop(df[df['Country Name']=="IBRD only"].index,axis=0)
df=df.drop(df[df['Country Name']=="Middle income"].index,axis=0)
df=df.drop(df[df['Country Name']=="Low & middle income"].index,axis=0)
df=df.drop(df[df['Country Name']=="IDA & IBRD total"].index,axis=0)
df=df.drop(df[df['Country Name']=="Post-demographic dividend"].index,axis=0)
df=df.drop(df[df['Country Name']=="Late-demographic dividend"].index,axis=0)
df=df.drop(df[df['Country Name']=="Upper middle income"].index,axis=0)
df=df.drop(df[df['Country Name']=="Late-demographic dividend"].index,axis=0)
df=df.drop(df[df['Country Name']=="North America"].index,axis=0)
df=df.drop(df[df['Country Name']=="East Asia & Pacific"].index,axis=0)
df=df.drop(df[df['Country Name']=="Euro area"].index,axis=0)
df=df.drop(df[df['Country Name']=="Early-demographic dividend"].index,axis=0)
df=df.drop(df[df['Country Name']=="East Asia & Pacific (excluding high income)"].index,axis=0)
df=df.drop(df[df['Country Name']=="East Asia & Pacific (IDA & IBRD countries)"].index,axis=0)
df=df.drop(df[df['Country Name']=="Late-demographic dividend"].index,axis=0)
df=df.drop(df[df['Country Name']=="Latin America & Caribbean"].index,axis=0)
df=df.drop(df[df['Country Name']=="Latin America & the Caribbean (IDA & IBRD coun..."].index,axis=0)
df=df.drop(df[df['Country Name']=="Latin America & Caribbean (excluding high income)"].index,axis=0)
df=df.drop(df[df['Country Name']=="Lower middle income"].index,axis=0)
df=df.drop(df[df['Country Name']=="Latin America & the Caribbean (IDA & IBRD coun..."].index,axis=0)
df=df.drop(df[df['Country Name']=="Europe & Central Asia (IDA & IBRD countries)"].index,axis=0)
df=df.drop(df[df['Country Name']=="Middle East & North Africa"].index,axis=0)
df=df.drop(df[df['Country Name']=="South Asia (IDA & IBRD)"].index,axis=0)
df=df.drop(df[df['Country Name']=="Europe & Central Asia (excluding high income) "].index,axis=0)
df=df.drop(df[df['Country Name']=="Arab World"].index,axis=0)
df=df.drop(df[df['Country Code']=="TLA"].index,axis=0)
df=df.drop(df[df['Country Code']=="ECA"].index,axis=0)
df=df.drop(df[df['Country Code']=="SAS"].index,axis=0)
df=df.drop(df[df['Country Code']=="ECA"].index,axis=0)
df=df.drop(df[df['Country Code']=="IDA"].index,axis=0)
df=df.drop(df[df['Country Code']=="SSF"].index,axis=0)
df=df.drop(df[df['Country Code']=="TSS"].index,axis=0)
df=df.drop(df[df['Country Code']=="SSA"].index,axis=0)
df=df.drop(df[df['Country Code']=="CEB"].index,axis=0)
df=df.drop(df[df['Country Code']=="PRE"].index,axis=0)
df=df.drop(df[df['Country Code']=="LDC"].index,axis=0)
df=df.drop(df[df['Country Code']=="IDB"].index,axis=0)
df=df.drop(df[df['Country Code']=="IDX"].index,axis=0)
df=df.drop(df[df['Country Code']=="FCS"].index,axis=0)
df=df.drop(df[df['Country Code']=="IDB"].index,axis=0)
df=df.drop(df[df['Country Code']=="HPC"].index,axis=0)
df=df.drop(df[df['Country Code']=="OSS"].index,axis=0)
df=df.drop(df[df['Country Code']=="SST"].index,axis=0)
df=df.drop(df[df['Country Code']=="LIC"].index,axis=0)
df=df.drop(df[df['Country Code']=="MNA"].index,axis=0)
df=df.drop(df[df['Country Code']=="TMN"].index,axis=0)
5.查看前10行数据
df.iloc[0:10,]
图像可视化
sns.set_style("whitegrid")
plt.figure(figsize=(30,8))
df = df.sort_values(by='2000',ascending=False)
sns.barplot(x='2000', y='Country Name',data=df.iloc[0:10,], orient='h')
结果

References:
世界GDP数据可视化的更多相关文章
- [译]学习IPython进行交互式计算和数据可视化(五)
第四章:交互式绘图接口 本章我们将展示Python的绘图功能以及如何在IPython中交互式地使用它们. NumPy为处理大量的多维数组结构的数据提供了高效的方法.但是看行行列列的数字总不如直接看曲线 ...
- [译]学习IPython进行交互式计算和数据可视化(三)
第二章 在本章中,我们将详细学习IPython相对以Python控制台带来的多种改进.特别的,我们将会进行下面的几个任务: 从IPython中使用系统shell以在shell和Python之间进行强大 ...
- HTML5大数据可视化效果(二)可交互地铁线路图
前言 最近特别忙,承蒙大伙关照,3D机房的项目一个接着一个,领了一帮小弟,搞搞传帮带,乌飞兔走,转眼已经菊黄蟹肥……有个小弟很不错,勤奋好学,很快就把API都摸透了,自己折腾着做了个HTML5的魔都的 ...
- 地理数据可视化:Simple,Not Easy
如果要给2015年的地理信息行业打一个标签,地理大数据一定是其中之一.在信息技术飞速发展的今天,“大数据”作为一种潮流铺天盖地的席卷了各行各业,从央视的春运迁徙图到旅游热点预测,从大数据工程师奇货可居 ...
- Linux 上的数据可视化工具
Linux 上的数据可视化工具 5 种开放源码图形化工具简介 Linux® 上用来实现数据的图形可视化的应用程序有很多,从简单的 2-D 绘图到 3-D 制图,再到科学图形编程和图形模拟.幸运的是,这 ...
- 【Data Visual】一文搞懂matplotlib数据可视化
一文搞懂matplotlib数据可视化 作者:白宁超 2017年7月19日09:09:07 摘要:数据可视化主要旨在借助于图形化手段,清晰有效地传达与沟通信息.但是,这并不就意味着数据可视化就一定因为 ...
- 爬虫综合大作业——网易云音乐爬虫 & 数据可视化分析
作业要求来自于https://edu.cnblogs.com/campus/gzcc/GZCC-16SE2/homework/3075 爬虫综合大作业 选择一个热点或者你感兴趣的主题. 选择爬取的对象 ...
- [数据可视化之一]Pandas单变量画图
Pandas单变量画图 Bar Chat Line Chart Area Chart Histogram df.plot.bar() df.plot.line() df.plot.area() df. ...
- 【Matplotlib】数据可视化实例分析
数据可视化实例分析 作者:白宁超 2017年7月19日09:09:07 摘要:数据可视化主要旨在借助于图形化手段,清晰有效地传达与沟通信息.但是,这并不就意味着数据可视化就一定因为要实现其功能用途而令 ...
随机推荐
- [PHP] RBAC权限与审批流的简单数据库构想
权限部分:功能权限+数据权限 控制权限是界面按钮菜单的权限控制,数据权限是数据范围的控制 role(角色) ----------------- |id | ----------------- |nam ...
- navicat for mysql 连接 mysql 出现Client does not support authentication protocol requested by server解决方案
一 .桌面左下角windows图标--搜索框内输入cmd,结果如图所示,点击cmd.exe,或者使用快捷键Windows键(在键盘上有个Windows标志的按键)+R输入cmd后回车. 二. 在出来的 ...
- Spring学习的第三天
问题分析:在刚开始进行银行转账案例时,会获取四个连接,分别是查询接入.转出账户.更新转入.转出账户.这样会使转账不同步,如果某一处出现异常,前面的代码执行了,而后面的更新却没执行,导致一个账户加钱而另 ...
- Excel上下标如何设置?
Excel表格怎么设置上下标?Excel上下标设置技巧 在21世纪的我们,平时的工作和学习中,经常会使用到一些专业的文档,比如方程式.数据的公式和科学计数等,其中均会涉及到许多的上下标符号输入以及使用 ...
- 服务监控之 Spring Boot Admin.
一.概述 开始阅读这篇文章之前,建议先阅读下<SpringBoot 之Actuator>,该篇文章提到 Spring Boot Actuator 提供了对单个Spring Boot的监控 ...
- kettle抽取数据发送邮件Linux调度
kettle抽取数据发送邮件Linux调度 #1.进入kettle安装目录 然后执行sqoop.sh文件启动kettlecd /app/pdi-ce-7.1.0.0-12/data-integrati ...
- 六、SQL优化
SQL优化 优化策略 一.尽量全值匹配 当建立了索引列后,尽量在where条件中使用所有的索引. CREATE TABLE `staffs`( id int primary key auto_incr ...
- 启动jar包并生成日志的linux脚本
启动脚本 nohup java -Xms300m -Xmx300m -jar $1 >log/$2 2>&1 & 使用方式 建立一个.sh结尾的脚本,里面放入此代码. 需要 ...
- [Spring cloud 一步步实现广告系统] 12. 广告索引介绍
索引设计介绍 在我们广告系统中,为了我们能更快的拿到我们想要的广告数据,我们需要对广告数据添加类似于数据库index一样的索引结构,分两大类:正向索引和倒排索引. 正向索引 通过唯一键/主键生成与对象 ...
- requests-html库render的使用
一.render的使用 from requests_html import HTMLSession session =HTMLSession() response = session.get('htt ...