chore: 批量新增各类工具脚本与配置文件
1. 新增音频录制、下载、上传相关脚本 2. 新增数据库操作、API调用工具 3. 新增Excel数据处理脚本 4. 新增弱密码检测脚本
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import pandas as pd
|
||||
import json
|
||||
|
||||
# 读取Excel文件
|
||||
df = pd.read_excel('e:/project/python/工具/智慧校园/本部/消费数据/2024学生.xlsx')
|
||||
|
||||
print("=== Excel文件基本信息 ===")
|
||||
print(f"数据形状: {df.shape}")
|
||||
print(f"\n列名: {df.columns.tolist()}")
|
||||
|
||||
print("\n=== 前10行数据 ===")
|
||||
print(df.head(10))
|
||||
|
||||
print("\n=== 数据类型 ===")
|
||||
print(df.dtypes)
|
||||
|
||||
# 提取唯一值
|
||||
print("\n=== 唯一值统计 ===")
|
||||
for col in df.columns:
|
||||
unique_count = df[col].nunique()
|
||||
print(f"{col}: {unique_count} 个唯一值")
|
||||
if unique_count <= 20:
|
||||
print(f" 值: {df[col].unique().tolist()}")
|
||||
|
||||
# 检查是否有年级和班级相关字段
|
||||
grade_class_cols = [col for col in df.columns if any(keyword in col.lower() for keyword in ['年级', '班级', 'grade', 'class'])]
|
||||
print(f"\n=== 年级/班级相关字段: {grade_class_cols} ===")
|
||||
|
||||
# 保存列名信息供后续使用
|
||||
with open('e:/project/python/工具/智慧校园/本部/消费数据/excel_info.json', 'w', encoding='utf-8') as f:
|
||||
info = {
|
||||
'columns': df.columns.tolist(),
|
||||
'shape': df.shape,
|
||||
'sample_data': df.head(5).to_dict('records')
|
||||
}
|
||||
json.dump(info, f, ensure_ascii=False, indent=2)
|
||||
|
||||
print("\n=== 信息已保存到 excel_info.json ===")
|
||||
Reference in New Issue
Block a user