Pandas 分組統計
阿新 • • 發佈:2018-12-19
– Start
import pandas as pd pd.set_option('display.max_columns', 100) pd.set_option('display.max_rows', 500) pd.set_option('display.width', 1000) # http://www.csindex.com.cn/zh-CN/downloads/indices?lb=%E5%85%A8%E9%83%A8&xl=1 # 通過讀取 Excel 檔案建立 DataFrame df = pd.read_excel("index300.xls", sheet_name="Directive Index") df.dropna(axis=1, inplace=True, thresh=5) print(df) groupbyIndexName = df.groupby('指數中文全稱Index Chinese Name(Full)') print(groupbyIndexName.count()) print(groupbyIndexName.mean()) print(groupbyIndexName.sum()) print(groupbyIndexName.std()) print(groupbyIndexName.describe()) print(groupbyIndexName.describe().transpose())
– 更多參見: – 聲 明:轉載請註明出處 – Last Updated on 2018-11-03 – Written by ShangBo on 2018-11-03 – End