Python decrypted the latest rich list in 2021. Ma Yun didn't even enter the top three

There are no ghosts in the world 2021-11-25 19:17:04
python decrypted latest rich list

Some time ago , Hurun research institute released 2021“ Hurun's rich list ”, This is the 1999 For the first time in a row since 23 Secondary release “ Hurun's rich list ”, For the ninth consecutive year, the threshold for listing has remained 20 One hundred million yuan , By analyzing this year's " Hurun's rich list " Look who these rich people are 、 The rich are mainly engaged in industries and so on . Come and have a look with me .
 Insert picture description here

1、 Data reading and preprocessing

df = pd.read_csv('/home/mw/input/hrbf9490/2021 Hurun Report - The list .csv')
df.replace('New ~','New',inplace=True)
df[' industry '] = df[' industry '].map(lambda x:x[3:])
df[' Ranking changes '] = df[' Ranking changes '].map(lambda x:x if x=='New' else('Up' if int(x)>0 else('Down' if int(x)<0 else 'Unchanged')))
df[' Wealth '] = df[' Wealth '].astype('int')
df[' figure 1'] = df[' Gender '].map(lambda x:x.split('、')[0])
df[' figure 2'] = df[' Gender '].map(lambda x:x.split('、')[1] if len(x) == 13 else '')
df.drop(' Gender ',axis=1,inplace=True)
df[' figure 1_ Gender '] = df[' figure 1'].map(lambda x:x.split()[0])
df[' figure 1_ Age '] = df[' figure 1'].map(lambda x:x.split()[1])
df[' figure 2_ Gender '] = df[' figure 2'].map(lambda x:x.split()[0] if len(x) != 0 else '')
df[' figure 2_ Age '] = df[' figure 2'].map(lambda x:x.split()[1] if len(x) != 0 else '')
df.drop([' figure 1',' figure 2'],axis=1,inplace=True)

2、 Rich list Top10 visualization The result is shown in Fig. :

 Insert picture description here
See this table , I thought about how Ma Yun, the richest man in my heart, came to the fifth place , The chairman of Yangshengtang Zhong Zhuo With 3900 RMB billion tops the list , The founder of byte beating Zhang Yiming With 3400 Billion yuan ranked second on the list ; In Ningde Era Zeng Yuqun With 3200 Billion yuan, ranking third , Those on the list are real rich people .

 Insert picture description here

2.1 Source code :

from pyecharts.charts import *
import pyecharts.options as opts
from pyecharts.commons.utils import JsCode
## Wealth 
bins = [0,50,100,500,1000,1800,10000000]
labels = ['0-50','50-100','100-500','500-1000','1000-1800','1800+']
df[' Wealth _cut'] = pd.cut(df[' Wealth '],bins,labels=labels)
df_t = df.head(10).sort_values(' Wealth ',ascending = True)
df_t = df_t[[' Wealth ',' full name ',' Enterprises ']]
df_t[' full name '] = df_t[' full name ']+' '+df_t[' Enterprises ']
# Rich text 
rich_text1 = {

"b": {
"color": "#ffffff","fontSize": 12, "lineHeight": 12},
"per": {

"color": "#ffffff",
bar = (Bar(init_opts=opts.InitOpts(width='980px',theme='light',bg_color='#070B50'))
.add_xaxis([y for x, y, z in df_t.values])
.add_yaxis('',[x for x, y, z in df_t.values],

'shadowBlur': 10,
'shadowColor': 'rgba(0, 0, 0, 0.5)',
'shadowOffsetY': 5,
'shadowOffsetX': 5,
'barBorderRadius': [10, 10, 10, 10],
formatter='{b}:{c} Billion ¥'
items = df[' Wealth _cut'].value_counts().index.tolist()
value = df[' Wealth _cut'].value_counts().values.tolist()
pie =(Pie()
.add('',[list(z) for z in zip(items,value)],radius=['15%','30%'],center=['77%','70%'])
.set_series_opts(label_opts=opts.LabelOpts(is_show=True,formatter="{b|{b}: }{per|{d}%} ",
bar.set_global_opts(title_opts=opts.TitleOpts(title='2021 China Hurun hundred rich list Top10',
subtitle=' Data sources :2021 year Hengchang Shaofang · Hurun's rich list ',pos_left='center',
legend_opts = opts.LegendOpts(is_show=False),

3、 Compared with last year's ranking change and the sex ratio of the rich The result is shown in Fig. :

 Insert picture description here
Yes 1605 The ranking of corporate tycoons is declining , Proportion to 55%, Rising stars are 838 A corporate tycoon , Accounted for as 28.72%, There are obviously more men than women , Scale close 9:1, I don't know when I can become a rich man in my dream .
 Insert picture description here

3.1 Source code :

df_t = pd.DataFrame(df[' figure 1_ Gender '].value_counts() + df[' figure 2_ Gender '].value_counts()).reset_index().dropna(axis=0)
df_t.columns = ['sex','count']
df_t1 = df. Ranking changes .value_counts().reset_index()
label = df_t['sex'].tolist()
value = df_t['count'].tolist()
label1 = df_t1['index'].tolist()
value1 = df_t1[' Ranking changes '].tolist()
# Rich text 
rich_text1 = {

"b": {
"color": "#ffffff","fontSize": 16, "lineHeight": 40},
"per": {

"color": "#ffffff",
"backgroundColor": "#334455",
"padding": [4, 2],
"borderRadius": 2,
pie =(Pie(init_opts=opts.InitOpts(width='980px',bg_color='#070B50',theme='light'))
.add('',[list(z) for z in zip(label,value)],radius=['25%','45%'],center=['75%','55%'],)
.add('',[list(z) for z in zip(label1,value1)],radius=['25%','45%'],center=['30%','55%'],)
.set_series_opts(label_opts=opts.LabelOpts(position='outsiede',formatter="{b|{b}: }{c} {per|{d}%} ",rich=rich_text1))
text='2021 Ranking change and gender ratio of China Hurun 100 rich list ',
text=' Data sources :2021 year Hengchang Shaofang · Hurun's rich list ',
text=' Ranking changes ',
text=' Gender ',

4、 What are the main jobs of the rich The result is shown in Fig. :

 Insert picture description here

4.1 Source code :

## Industry word cloud 
hy = []
for i in df[' industry '].map(lambda x:x.split('、')):
df_t = pd.DataFrame(hy,columns=[' industry '])
df1 = df_t[' industry '].value_counts().reset_index()
cloud_words = [tuple(xi) for xi in df1.values]
wc = (
.add("", cloud_words,word_size_range=[10, 120],shape='diamond')
.set_global_opts(title_opts=opts.TitleOpts(title='2021 Top industries on China Hurun rich list ',
subtitle=' Data sources :2021 year Hengchang Shaofang · Hurun's rich list ',pos_left='center',))

 Insert picture description here
Sure enough , Real estate is the most profitable , There are also the most people who do real estate , The second is the investment industry and the pharmaceutical industry , Let's go , We sell real estate to .

receive Q Group number : 675240729( Pure technology exchange and resource sharing ) Take it by yourself .

① Industry consulting 、 Professional answers
②Python Development environment installation tutorial
③400 Self study video
④ Software development vocabulary
⑤ The latest learning roadmap
⑥3000 Multiple copies Python e-book

本文为[There are no ghosts in the world]所创,转载请带上原文链接,感谢

  1. 关于#python_while循环的写法#的问题,如何解决?
  2. Python异常处理中异常的种类有哪些?你知道几个?
  3. Python异常處理中异常的種類有哪些?你知道幾個?
  4. Quels sont les types d'exceptions dans la gestion des exceptions python? Combien en savez - vous?
  5. À propos de # Python Comment résoudre le problème de l'écriture de la Boucle while?
  6. Python如何操作数据库
  7. python数字游戏,让你欲罢不能
  8. Python中的可迭代对象、迭代器、For循环工作机制、生成器
  9. 一个从没接触过编程的人,如何自学进入Python行业?
  10. 一份超级实用的 Python ”技巧“清单
  11. Python 程序员给上路初学者的3点忠告
  12. 3 conseils pour les débutants sur la route par les programmeurs Python
  13. Une liste de conseils Python super pratiques
  14. Comment quelqu'un qui n'a jamais été en contact avec la programmation peut - il apprendre à entrer dans l'industrie python?
  15. Objets itérables, itérateurs, pour le mécanisme de travail circulaire, générateurs en python
  16. Les Jeux de chiffres Python vous font vous arrêter
  17. Comment Python fonctionne avec la base de données
  18. Python之html与markdown互相转换
  19. Python之html與markdown互相轉換
  20. Conversion HTML et markdown de Python
  21. Python生成的随机数,要怎么设定成随机数a小于随机数b啊
  22. Python生成的隨機數,要怎麼設定成隨機數a小於隨機數b啊
  23. Le nombre aléatoire généré par Python, comment définir le nombre aléatoire a est inférieur au nombre aléatoire B
  24. Python爬虫能做什么
  25. Python老技师给上路初学者的3点忠告
  26. 3 conseils aux débutants sur la route de l'ancien technicien Python
  27. Que peuvent faire les reptiles Python
  28. The code NPM cloned from git will report a python error after it is installed!
  29. 数据分析从零开始实战,Pandas读写CSV数据
  30. Python基础(十二):类与对象
  31. Python Foundation (12): classes et objets
  32. Python基礎(十二):類與對象
  33. L'analyse des données commence à zéro et pandas lit et écrit les données CSV
  34. Python Qt GUI设计:QSlider滑动条类(基础篇—16)
  35. #yyds干货盘点#数据分析从零开始实战,Pandas读写CSV数据
  36. This paper designs an examination system for automatically setting questions and judging papers by using Python standard library language to investigate the ability of users to calculate four integers within 100.
  37. Yyds Dry Inventory # Data Analysis started from zero, pandas read and write CSV Data
  38. python数据结构:数组、列表、栈、队列及实现
  39. Python编程真的是未来人工智能的主流吗?
  40. Python编写通讯录,支持模糊查询,利用数据库存储
  41. Python編寫通訊錄,支持模糊查詢,利用數據庫存儲
  42. Python編程真的是未來人工智能的主流嗎?
  43. Python écrit le carnet d'adresses, prend en charge les requêtes floues et utilise le stockage de base de données
  44. La programmation Python est - elle vraiment le courant dominant de l'IA future?
  45. Structure des données Python: tableaux, listes, piles, files d'attente et implémentations
  46. Python networkx Practical Social Network Visualization
  47. [译] 通过 for 循环,比较 Python 与 Ruby 编程思想的差别
  48. Comparez les différences de programmation entre Python et Ruby à travers la boucle for
  49. Python basic and introductory tutorials
  50. What you don't know
  51. 人生苦短,能让你更早下班的Python垃圾回收机制
  52. Boring playing Tetris, using Python to do their own without advertising
  53. Seemingly boring Python games, but I fished for work all afternoon!!
  54. A collection of grammar knowledge points for getting started with Python
  55. Benefits of learning Python
  56. Play childhood memories with Python, greedy snake
  57. Python is suitable for beginners
  58. Simple Python game making
  59. Welfare is coming!! Python basic syntax dry goods
  60. Simply understand the learning direction of Python and make yourself a better choice