标签:eject python3 http attribute x-pack ansi c toolbar pre you
import pandas as pd
f = open(‘D:/Project/180414山东癌症交接/初始数据/1973to2015.csv‘)
all_data = pd.read_csv(f)
df2014 = all_data[(all_data[‘year‘] == 2014) & (all_data[‘sex‘] == ‘合计‘)]
df2014.rename(columns={ ‘cu‘: ‘cu2014‘, ‘norm‘: ‘norm2014‘}, inplace=True)
df2005 = all_data[(all_data[‘year‘] == 2005)& (all_data[‘sex‘] == ‘合计‘)]
df2005.rename(columns={ ‘cu‘: ‘cu2005‘, ‘norm‘: ‘norm2005‘}, inplace=True)
me_data = pd.merge(df2014,df2005,how=‘inner‘,on=‘code‘)
me_data = pd.merge(me_data,df2014,how=‘inner‘,on=‘code‘)
norm = me_data[[‘code‘,‘norm1975‘,‘norm1992‘,‘norm2005‘,‘norm2014‘]]
cu = me_data[[‘code‘,‘cu1975‘,‘cu1992‘,‘cu2005‘,‘cu2014‘]]
norm.to_csv("D:/Project/norm.csv")
cu.to_csv("D:/Project/cu.csv")
标签:eject python3 http attribute x-pack ansi c toolbar pre you
原文地址:https://www.cnblogs.com/lichunl/p/9005084.html