market_assistant/analysis.py

16 lines
437 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import pandas as pd
# 读取Excel文件
df = pd.read_excel('pingcap_pipeline.xlsx')
# 按照"客户分类"列分组并计算ACV列的和
acv_name = '预估 ACV'
grouped_df = df.groupby('负责人所属行业')[acv_name].sum().astype(int).reset_index()
grouped_df = grouped_df.sort_values(by=acv_name, ascending=False)
grouped_df[acv_name] = grouped_df[acv_name].apply(lambda x: '{:,}'.format(x))
# 打印结果
print(grouped_df)