您当前的位置: 首页 >  Python

魔王不会哭

暂无认证

  • 5浏览

    0关注

    149博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

【数据分析】python带你分析122万人的生活工作和死亡数据

魔王不会哭 发布时间:2022-10-10 15:03:13 ,浏览量:5

前言

嗨喽~大家好呀,这里是魔王呐 !

闲的无聊的得我又来倒腾代码了~

今天给大家分享得是——122万人的生活工作和死亡数据分析

准备好了嘛~现在开始发车喽!!

目录
    • 前言
    • 所需素材
    • 代码
    • 尾语

所需素材

获取素材点击

代码
import pandas as pd

df = pd.read_csv('.\data\AgeDatasetV1.csv')
df.info()

df.describe().to_excel(r'.\result\describe.xlsx')
df.isnull().sum().to_excel(r'.\result\nullsum.xlsx')
df[df.duplicated()].to_excel(r'.\result\duplicated.xlsx')

df.rename(columns=lambda x: x.replace(' ', '_').replace('-', '_'), inplace=True)
print(df.columns)
print(df[df['Birth_year']  100].shape[0],
         df1.shape[0] - df1[(df1['Age_of_death']  90)].shape[0],
         df1[(df1['Age_of_death']  70)].shape[0],
         df1[(df1['Age_of_death']  50)].shape[0],
         df1.shape[0] - (df1[df1['Age_of_death'] > 100].shape[0] +
                         df1[(df1['Age_of_death']  90)].shape[0]
                         + df1[(df1['Age_of_death']  50)].shape[0]
                         + df1[(df1['Age_of_death']  70)].shape[0])
         ]

age = ['> 100', '> 90 &  70 &  50 &             
关注
打赏
1665385393
查看更多评论
0.0459s