各国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 (current US$)

世界GDP数据可视化的更多相关文章

  1. [译]学习IPython进行交互式计算和数据可视化(五)

    第四章:交互式绘图接口 本章我们将展示Python的绘图功能以及如何在IPython中交互式地使用它们. NumPy为处理大量的多维数组结构的数据提供了高效的方法.但是看行行列列的数字总不如直接看曲线 ...

  2. [译]学习IPython进行交互式计算和数据可视化(三)

    第二章 在本章中,我们将详细学习IPython相对以Python控制台带来的多种改进.特别的,我们将会进行下面的几个任务: 从IPython中使用系统shell以在shell和Python之间进行强大 ...

  3. HTML5大数据可视化效果(二)可交互地铁线路图

    前言 最近特别忙,承蒙大伙关照,3D机房的项目一个接着一个,领了一帮小弟,搞搞传帮带,乌飞兔走,转眼已经菊黄蟹肥……有个小弟很不错,勤奋好学,很快就把API都摸透了,自己折腾着做了个HTML5的魔都的 ...

  4. 地理数据可视化:Simple,Not Easy

    如果要给2015年的地理信息行业打一个标签,地理大数据一定是其中之一.在信息技术飞速发展的今天,“大数据”作为一种潮流铺天盖地的席卷了各行各业,从央视的春运迁徙图到旅游热点预测,从大数据工程师奇货可居 ...

  5. Linux 上的数据可视化工具

    Linux 上的数据可视化工具 5 种开放源码图形化工具简介 Linux® 上用来实现数据的图形可视化的应用程序有很多,从简单的 2-D 绘图到 3-D 制图,再到科学图形编程和图形模拟.幸运的是,这 ...

  6. 【Data Visual】一文搞懂matplotlib数据可视化

    一文搞懂matplotlib数据可视化 作者:白宁超 2017年7月19日09:09:07 摘要:数据可视化主要旨在借助于图形化手段,清晰有效地传达与沟通信息.但是,这并不就意味着数据可视化就一定因为 ...

  7. 爬虫综合大作业——网易云音乐爬虫 & 数据可视化分析

    作业要求来自于https://edu.cnblogs.com/campus/gzcc/GZCC-16SE2/homework/3075 爬虫综合大作业 选择一个热点或者你感兴趣的主题. 选择爬取的对象 ...

  8. [数据可视化之一]Pandas单变量画图

    Pandas单变量画图 Bar Chat Line Chart Area Chart Histogram df.plot.bar() df.plot.line() df.plot.area() df. ...

  9. 【Matplotlib】数据可视化实例分析

    数据可视化实例分析 作者:白宁超 2017年7月19日09:09:07 摘要:数据可视化主要旨在借助于图形化手段,清晰有效地传达与沟通信息.但是,这并不就意味着数据可视化就一定因为要实现其功能用途而令 ...

随机推荐

  1. 阿里云ECS服务器部署HADOOP集群(五):Pig 安装

    本篇将在阿里云ECS服务器部署HADOOP集群(一):Hadoop完全分布式集群环境搭建的基础上搭建. 1 环境介绍 一台阿里云ECS服务器:master 操作系统:CentOS 7.3 Hadoop ...

  2. Cocos2d-x开发教程——《萝莉快跑》

    更好的阅读体验请前往<萝莉快跑>开发教程. 配置:win7+Cocos2d-x.2.0.3+VS2012 目标读者:已经了解图形显示.动作.回调函数.定时器的用法. 一.基本知识点 1.动 ...

  3. JavaScript-----10.作用域

    1.作用域 一段程序代码中所用到的名字不是总是有效和可用的,而限定这个名字的可用性的代码范围就是这个名字的作用域.目的是为了提高程序的可靠性,更重要的是减少命名冲突. 在es6之前,js的作用域有:全 ...

  4. php 重复问题

    结果: 结论: 尽量在方法内用变量去接受重复的参数或重复的方法/结果,消耗的时间积少成多

  5. angularjs $scope与this的区别,controller as vm有何含义?

     壹 ❀ 引 初学angularjs的同学对于$scope一定不会陌生,scope(作用域)是将view(视图)与model(模板)关联起来的桥梁,通过controller(控制器)对于model的数 ...

  6. Exe4j 打包: this executable was created with an evaluation version of exe4j

    异常 this executable was created with an evaluation version of exe4j   异常.png 问题原因 当前打包使用exe4j未授权 解决方法 ...

  7. 一、I/O模型之BIO

    I/O模型之BIO 基本介绍 Java BIO 就是传统的 Java IO 编程,其相关的类和接口再 java.io 包下 BIO(blocking I/O):同步阻塞,服务器实现模式为一个连接一个线 ...

  8. JS如何判断鼠标滚轮向上还是向下滚动

    前几天偶然看到某前端群有人在问:JS如何判断鼠标滚轮向上还是向下滚动? 我想了想,有点蒙蔽,心想难道不是用scrollTop来判断吗? 但我不确定,也出于好奇心,于是开始了一番探索 思路:通过even ...

  9. ROS基础-基本概念和简单工具(1)

    1.什么是ROS? Robot operating System ,简单说机器人操作系统,弱耦合的分布式进程框架,通过进程间的消息传递和管理.实现硬件抽象和设备控制. 2.节点(node) node ...

  10. Java题库——Chapter13抽象类和接口

    )What is the output of running class Test? public class Test { public static void main(String[ ] arg ...