search
HomeBackend DevelopmentPython TutorialPandas+Pyecharts | 2022 Fortune 500 Data Analysis Visualization


In this issue, we use Python to analyze the information data of the world's top 500 companies in 2022, take a look:

  • What countries are the top 500 companies roughly distributed in?
  • Top 500 companies What are the Chinese companies and their distribution in various cities in the country
  • Profit and loss situation of the top 500 companies
  • ...
Hope it will be helpful, if you have any questions or need If you want to improve, you can send a private message to the editor.

Libraries involved:

  • Pandas — Data Processing

  • Pyecharts — Data Visualization

##Visualization Section:

  • Pictogram — PictorialBar

  • Bar chart — Bar

  • Map — Map

  • ##Geographic coordinate system — Geo

  • Water Polo Chart — Liquid

  • Polar Coordinate Chart — Polar

  • Word Cloud — WordCloud

1. Import module

##
import pandas as pd 
from pyecharts.charts import Pie
from pyecharts.charts import Bar
from pyecharts.charts import Grid
from pyecharts.charts import Map
from pyecharts.charts import Geo
from pyecharts.charts import WordCloud
from pyecharts.charts import PictorialBar
from pyecharts.charts import Liquid
from pyecharts.charts import Polar
from pyecharts import options as opts
from pyecharts.commons.utils import JsCode


2. Pandas数据处理

2.1 读取数据 
df = pd.read_excel('2022年世界五百强排行榜.xlsx')
df.head(10)

Pandas+Pyecharts | 2022 Fortune 500 Data Analysis Visualization

2.2 查看数据信息 

df.info()

Pandas+Pyecharts | 2022 Fortune 500 Data Analysis Visualization

500条数据没有确缺失,不需要进行其他处理。


3. Pyecharts数据可视化

3.1 各国世界500强企业数量排名柱状图 
bar = (
    Bar(init_opts=opts.InitOpts(width='1000px', height='1000px',bg_color='#0d0735'))
    .add_xaxis(x_data)
    .add_yaxis("",y_data)
    .set_series_opts(label_opts=opts.LabelOpts(position="right",
                                              font_size=12,
                                              font_weight='bold',
                                              formatter='{c} 家'),
                    )
    .set_global_opts(
                    xaxis_opts=opts.AxisOpts(is_show=False,),
                    yaxis_opts=opts.AxisOpts(
                        axislabel_opts=opts.LabelOpts(font_size=13,color='#fff200'),
                        axistick_opts=opts.AxisTickOpts(is_show=False),
                        axisline_opts=opts.AxisLineOpts(is_show=False)
                    ),
                    title_opts=opts.TitleOpts(title="各国世界500强企业数量排名",pos_left='center',pos_top='1%',
                              title_textstyle_opts=opts.TextStyleOpts(font_size=22,color="#38d9a9")),
                    visualmap_opts=opts.VisualMapOpts(is_show=False, 
                                      min_=20,
                                      max_=150,
                                      is_piecewise=False,
                                      dimension=0,
                                      range_color=['#203fb6', '#008afb', '#ffec4a', '#ff6611', '#f62336']
                                                     ),
                    )
    .reversal_axis()
)

Pandas+Pyecharts | 2022 Fortune 500 Data Analysis Visualization

  • 我国以145家世界500强企业高居榜首
  • 美国128家、日本47家位居二、三位
  • 亚洲方面还有韩国以18家的数量排名第六
3.2 各国世界500强企业数量排名TOP8极坐标图 
p = (
    Polar(init_opts=opts.InitOpts(width='1000px', height='800px', bg_color='#0d0735'))
    .add_schema(
        radiusaxis_opts=opts.RadiusAxisOpts(data=x_data[-8:], 
                                            type_='category'),
        angleaxis_opts=opts.AngleAxisOpts(
              is_clockwise=True, 
              is_scale=True,
              max_=150,
              axislabel_opts=opts.LabelOpts(font_size=14, color='#fff200'),
              axisline_opts=opts.AxisLineOpts(is_show=True,linestyle_opts=opts.LineStyleOpts(
                                                    width=2,type_='dashed',color='#e4e932')),
              splitline_opts=opts.SplitLineOpts(is_show=True,
                    linestyle_opts=opts.LineStyleOpts(type_='dashed', color='#9FC131')
                ),
             ),
    )
    .add('',y_data[-8:], type_='bar')
    .set_global_opts( 
        title_opts=opts.TitleOpts(title='各国世界500强企业数量排名TOP8',subtitle='制图@公众号:Python当打之年',pos_left='center',pos_top='1%',
            title_textstyle_opts=opts.TextStyleOpts(color='#38d9a9',font_size=20)
        ),
         visualmap_opts=opts.VisualMapOpts(max_=150, is_show = False, is_piecewise=True, split_number = 8, min_ = 10,
                                           range_color=['#203fb6', '#008afb', '#ffec4a', '#ff6611', '#f62336'] 
                                          ),
    )
)

Pandas+Pyecharts | 2022 Fortune 500 Data Analysis Visualization

3.3 各国世界500强企业数量占比饼状图

Pandas+Pyecharts | 2022 Fortune 500 Data Analysis Visualization

  • 我国世界500强企业有145家,占比高达29%,接近总量的1/3

  • The United States accounts for 24.8 and Japan accounts for 9.4%

##3.4 TOP8 pictograms of the number of Fortune 500 companies in each country

Pandas+Pyecharts | 2022 Fortune 500 Data Analysis Visualization

##3.5 Bar chart of the number of Fortune 500 companies in each Chinese city

Pandas+Pyecharts | 2022 Fortune 500 Data Analysis Visualization Domestic aspects:

  • my country’s 145 Fortune 500 companies are basically based on first-line Most cities
  • Beijing ranks first with 54 Fortune 500 companies, followed by Shanghai and Shenzhen with 12 and 10 companies respectively
  • Beijing, Shanghai, Guangzhou, Shenzhen and Zhongshan,

    Guangzhou fell out of the top 5 with 4 companies, ranking 7th

3.6 各国世界500强企业数量地图分布
m1 = (
    Map(init_opts=opts.InitOpts(width='1000px', height='500px',theme='dark',bg_color='#0d0735')) 
    .add('公司数量', 
         region_data, 
         "world", 
         is_map_symbol_show=False,
         is_roam=False, 
        )
    .set_series_opts(label_opts=opts.LabelOpts(is_show=False))
    .set_global_opts(
        legend_opts=opts.LegendOpts(is_show=False),
        visualmap_opts=opts.VisualMapOpts(is_show=True, 
                                          max_=150,
                                          min_=0,
                                          is_piecewise=True,
                                          split_number=10,
                                          pos_top='50%',
                                          pos_left='10%',
                                          range_color=['#9ecae1','#6baed6','#4292c6','#2171b5','#08519c','#08306b','#d4b9da','#c994c7','#df65b0','#e7298a','#ce1256','#980043','#67001f']
        ), 
    )
)

Pandas+Pyecharts | 2022 Fortune 500 Data Analysis Visualization

效果2:

3.7 中国世界500强企业数量占比水球图

Pandas+Pyecharts | 2022 Fortune 500 Data Analysis Visualization

3.8 世界500强企业公司名称词云
wd = WordCloud(init_opts=opts.InitOpts(width='1000px',height='600px',theme='dark',bg_color='#0d0735'))
wd.add('', 
       [list(z) for z in zip(x_data, y_data)],
      )
wd.set_global_opts(
        title_opts=opts.TitleOpts(
            title=""),
        tooltip_opts=opts.TooltipOpts(is_show=True),
    )
wd.render_notebook()

Pandas+Pyecharts | 2022 Fortune 500 Data Analysis Visualization

营收方面:

  • Walmart ranks first with operating income of US$572,754 million, Amazon ranks second with operating income of US$469,822 million, and State Grid Corporation of my country ranks first with operating income of US$469,822 million. 460616.9 million US dollars, ranking 3rd
  • A total of 4 companies in my country have entered the top 10 of the Fortune 500 list: State Grid Co., Ltd. ( 3), China National Petroleum Corporation (4), China Petrochemical Corporation (5), China State Construction Engineering Corporation (9)
##4.
Online running address

#Part of the code is not shown due to space reasons, Online running address (including source code)

##https://www.heywhale.com/mw/project/6318517d9b96502cad5c5ab0

The above is the detailed content of Pandas+Pyecharts | 2022 Fortune 500 Data Analysis Visualization. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:Python当打之年. If there is any infringement, please contact admin@php.cn delete
The Main Purpose of Python: Flexibility and Ease of UseThe Main Purpose of Python: Flexibility and Ease of UseApr 17, 2025 am 12:14 AM

Python's flexibility is reflected in multi-paradigm support and dynamic type systems, while ease of use comes from a simple syntax and rich standard library. 1. Flexibility: Supports object-oriented, functional and procedural programming, and dynamic type systems improve development efficiency. 2. Ease of use: The grammar is close to natural language, the standard library covers a wide range of functions, and simplifies the development process.

Python: The Power of Versatile ProgrammingPython: The Power of Versatile ProgrammingApr 17, 2025 am 12:09 AM

Python is highly favored for its simplicity and power, suitable for all needs from beginners to advanced developers. Its versatility is reflected in: 1) Easy to learn and use, simple syntax; 2) Rich libraries and frameworks, such as NumPy, Pandas, etc.; 3) Cross-platform support, which can be run on a variety of operating systems; 4) Suitable for scripting and automation tasks to improve work efficiency.

Learning Python in 2 Hours a Day: A Practical GuideLearning Python in 2 Hours a Day: A Practical GuideApr 17, 2025 am 12:05 AM

Yes, learn Python in two hours a day. 1. Develop a reasonable study plan, 2. Select the right learning resources, 3. Consolidate the knowledge learned through practice. These steps can help you master Python in a short time.

Python vs. C  : Pros and Cons for DevelopersPython vs. C : Pros and Cons for DevelopersApr 17, 2025 am 12:04 AM

Python is suitable for rapid development and data processing, while C is suitable for high performance and underlying control. 1) Python is easy to use, with concise syntax, and is suitable for data science and web development. 2) C has high performance and accurate control, and is often used in gaming and system programming.

Python: Time Commitment and Learning PacePython: Time Commitment and Learning PaceApr 17, 2025 am 12:03 AM

The time required to learn Python varies from person to person, mainly influenced by previous programming experience, learning motivation, learning resources and methods, and learning rhythm. Set realistic learning goals and learn best through practical projects.

Python: Automation, Scripting, and Task ManagementPython: Automation, Scripting, and Task ManagementApr 16, 2025 am 12:14 AM

Python excels in automation, scripting, and task management. 1) Automation: File backup is realized through standard libraries such as os and shutil. 2) Script writing: Use the psutil library to monitor system resources. 3) Task management: Use the schedule library to schedule tasks. Python's ease of use and rich library support makes it the preferred tool in these areas.

Python and Time: Making the Most of Your Study TimePython and Time: Making the Most of Your Study TimeApr 14, 2025 am 12:02 AM

To maximize the efficiency of learning Python in a limited time, you can use Python's datetime, time, and schedule modules. 1. The datetime module is used to record and plan learning time. 2. The time module helps to set study and rest time. 3. The schedule module automatically arranges weekly learning tasks.

Python: Games, GUIs, and MorePython: Games, GUIs, and MoreApr 13, 2025 am 12:14 AM

Python excels in gaming and GUI development. 1) Game development uses Pygame, providing drawing, audio and other functions, which are suitable for creating 2D games. 2) GUI development can choose Tkinter or PyQt. Tkinter is simple and easy to use, PyQt has rich functions and is suitable for professional development.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function