一、安装
pip install pandas
如果出报错,不能运行,可以安装
pip install xlrd
二、 代码如下
import pandas as pd import time,datetimefile_path = r'C:\Users\Administrator\Desktop\携号转网测试\admin_log.xls' df = pd.read_excel(file_path, sheet_name = "admin",header=None) # print(df.values[1,0]) data=[] for i in range(len(df)):timechuo = df.values[i,0]time_local = time.localtime(timechuo)dt = time.strftime("%Y-%m", time_local)data.append(dt)result = pd.value_counts(data) print(result)