import numpy as np import pandas as pd

df = pd.read_excel('2023_2_23No1_data.xlsx',sheet_name='Sheet', index_col=0) index = [1,2,3,7,11,17,23,31,43,61,89,127,179,251,349] my_df = [] df_name = df for i in range(len(index)): the_df = df_name + str(index[i]) the_df = df[df['name'] == 'peritumor'] &(df['frequency'] == index[i]) & (df['conductivity'] > 0) my_df.append(the_df)

result = [] for item in my_df: result.append((sum(item['conductivity']))/(item.shape[0]))

df_result = pd.DataFrame({'result': result}) df_result.to_csv('result.csv', index=False)


原文地址: https://www.cveoy.top/t/topic/ndsL 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录