python指定列索引筛选数据

#导入包
import pandas  as pd
import numpy as np
from pandas  import Series,DataFrame
# from numpy import mean, ptp, var, std
#读取数据
df_season = pd.read_excel('e://xionghuan//20201123/pathway_1_2.xlsx',sheet_name='Pathway_2')
df_site = pd.read_excel('e://xionghuan//20201123/pathway_1_2.xlsx',sheet_name='Pathway_2')
#赛选数据按指定的赛选
withering = df_season.query('season==1')
#数据切片 loc[行,列] 按标签筛选
withering = withering.loc[:,'Aging'::]
#描述统计
withering = withering.describe().round(2).loc[['mean','std']].T
# withering['mean±std'] = withering['mean'].map(str)+'+'+withering['std'].map(str)
# withering['mean±std'] = withering['mean']+withering['std']
#pandas 新增一列
withering['mean±std'] = withering['mean'].astype(str)+'+'+withering['std'].astype(str)
withering

你可能感兴趣的:(python)