import pandas as pd df = pd.read_excel(r"D:\200-生活\贫困户.xlsx",dtype={'身份证号': "str"}) df1 = df.set_index('身份证号') df2 = pd.read_excel(r"D:\200-生活\房产数据.xlsx",dtype={'身份证号': "str"}) df3 = df2.set_index('身份证号') df4 = df1.join(df3,how="inner") print(df4) df4.to_excel(r"D:\200-生活\youfangchan.xlsx")
#(为凑字数,加一段取出不同年份行业的中位数)
df = pd.read_excel(r"D:\300-学习\320-首都经贸\323-论文\car计算\SZA行业中位数.xlsx") df = df.groupby(by='交易日期').quantile(0.5) #取行业每天的涨跌幅的中位数 df['trade_date'] = pd.to_datetime(df['trade_date'], format="%Y-%m-%d")