import pandas as pd # 创建示例 DataFrame data = { 'A': [1, 2, 3, 4, 5], 'B': [10, 20, 30, 40, 50] } df = pd.DataFrame(data) # 对列 'B' 求和 column_sum = df['B'].sum() print("Sum of column B:", column_sum) # 对某列求平均值 column_mean = df['B'].mean() print("Mean of column B:", column_mean) # 对某列计数 column_count = df['B'].count() print("Count of column B:", column_count) # 对某列求最大值 column_max = df['B'].max() print("Max of column B:", column_max) # 对某列求最小值 column_min = df['B'].min() print("Min of column B:", column_min)
标签:某列,column,sum,DataFrame,df,最小值,某列求,print From: https://www.cnblogs.com/nicole-zhang/p/17613946.html