其他行的平均值是列的总和减去行值除以列的大小减去1。在Pandas中,其写为:
df['A'] = (df['X'].sum() - df['X'])/(len(df) - 1)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.