当前位置:首页>python>15_Python数据分析:分组操作 (GroupBy)

15_Python数据分析:分组操作 (GroupBy)

  • 2026-04-16 03:42:03
15_Python数据分析:分组操作 (GroupBy)

Python数据分析:分组操作 (GroupBy)

1. 核心知识点概述

GroupBy是Pandas中非常强大的数据分析工具,遵循"拆分-应用-合并"(split-apply-combine)模式:

  • groupby()
    : 按指定列分组,创建GroupBy对象。
  • 聚合操作
    sum()mean()count()min()max()等。
  • 转换操作
    transform()对每个分组进行转换,保持原DataFrame形状。
  • 过滤操作
    filter()根据条件筛选分组。
  • 应用自定义函数
    apply()对每个分组应用自定义函数。

关键参数说明

  • by
    : 分组依据的列名或列名列表。
  • as_index
    : 是否将分组键作为索引(默认True)。
  • sort
    : 是否对分组键排序(默认True)。
  • agg()
    : 同时应用多个聚合函数。

2. 示例代码

2.1 准备数据

In [1]:

import pandas as pd
import numpy as np
# 创建示例数据
np.random.seed(42)
data = {
    'department': ['Sales', 'Sales', 'IT', 'IT', 'HR', 'HR', 'Sales', 'IT', 'HR', 'Sales'],
    'employee': ['Alice', 'Bob', 'Charlie', 'David', 'Eve', 'Frank', 'Grace', 'Henry', 'Ivy', 'Jack'],
    'gender': ['F', 'M', 'M', 'M', 'F', 'M', 'F', 'M', 'F', 'M'],
    'salary': np.random.randint(5000, 15000, 10),
    'bonus': np.random.randint(500, 2000, 10),
    'years': np.random.randint(1, 10, 10)
}
df = pd.DataFrame(data)
df['total_comp'] = df['salary'] + df['bonus']
print("原始数据:")
print(df)
原始数据:
  department employee gender  salary  bonus  years  total_comp
0      Sales    Alice      F   12270   1832      6       14102
1      Sales      Bob      M    5860   1269      9        7129
2         IT  Charlie      M   10390    843      1       11233
3         IT    David      M   10191   1937      3       12128
4         HR      Eve      F   10734   1305      7       12039
5         HR    Frank      M   11265    885      4       12150
6      Sales    Grace      F    5466   1715      9        7181
7         IT    Henry      M    9426   1455      3       10881
8         HR      Ivy      F   10578    776      5       11354
9      Sales     Jack      M   13322   1684      3       15006

2.2 基础分组与聚合

按单列分组并进行聚合计算。

In [2]:

# 按部门分组,计算平均工资
dept_avg_salary = df.groupby('department')['salary'].mean()
print("\n各部门平均工资:")
print(dept_avg_salary)
# 按部门分组,计算多个统计量
dept_stats = df.groupby('department')['salary'].agg(['count', 'sum', 'mean', 'min', 'max'])
print("\n各部门薪资统计:")
print(dept_stats)
# 多列聚合
dept_multi = df.groupby('department')[['salary', 'bonus', 'total_comp']].mean()
print("\n各部门平均薪资、奖金、总薪酬:")
print(dept_multi)
各部门平均工资:
department
HR       10859.000000
IT       10002.333333
Sales     9229.500000
Name: salary, dtype: float64
各部门薪资统计:
            count    sum          mean    min    max
department                                          
HR              3  32577  10859.000000  10578  11265
IT              3  30007  10002.333333   9426  10390
Sales           4  36918   9229.500000   5466  13322
各部门平均薪资、奖金、总薪酬:
                  salary        bonus    total_comp
department                                         
HR          10859.000000   988.666667  11847.666667
IT          10002.333333  1411.666667  11414.000000
Sales        9229.500000  1625.000000  10854.500000

2.3 多列分组

按多个列进行分组。

In [3]:

# 按部门和性别分组
dept_gender = df.groupby(['department', 'gender'])['salary'].mean()
print("\n各部门性别平均工资:")
print(dept_gender)
# 重置索引
dept_gender_reset = df.groupby(['department', 'gender'], as_index=False)['salary'].mean()
print("\n重置索引后:")
print(dept_gender_reset)
# 多列分组多聚合
dept_gender_stats = df.groupby(['department', 'gender']).agg({
    'salary': ['mean', 'min', 'max'],
    'years': 'mean'
})
print("\n各部门性别详细统计:")
print(dept_gender_stats)
各部门性别平均工资:
department  gender
HR          F         10656.000000
            M         11265.000000
IT          M         10002.333333
Sales       F          8868.000000
            M          9591.000000
Name: salary, dtype: float64
重置索引后:
  department gender        salary
0         HR      F  10656.000000
1         HR      M  11265.000000
2         IT      M  10002.333333
3      Sales      F   8868.000000
4      Sales      M   9591.000000
各部门性别详细统计:
                         salary                   years
                           mean    min    max      mean
department gender                                      
HR         F       10656.000000  10578  10734  6.000000
           M       11265.000000  11265  11265  4.000000
IT         M       10002.333333   9426  10390  2.333333
Sales      F        8868.000000   5466  12270  7.500000
           M        9591.000000   5860  13322  6.000000

2.4 agg() 多聚合函数

使用agg()同时应用多个聚合函数。

In [4]:

# 对单列应用多个聚合函数
salary_agg = df.groupby('department')['salary'].agg(['count', 'sum', 'mean', 'std', 'min', 'max'])
print("\n薪资多维度统计:")
print(salary_agg)
# 对不同列应用不同聚合函数
custom_agg = df.groupby('department').agg({
    'salary': ['mean', 'max'],
    'bonus': 'sum',
    'years': ['mean', 'min', 'max'],
    'employee': 'count'
})
print("\n自定义聚合:")
print(custom_agg)
# 使用自定义聚合函数
def salary_range(x):
    return x.max() - x.min()
custom_func = df.groupby('department')['salary'].agg(['mean', salary_range])
custom_func.columns = ['mean_salary', 'salary_range']
print("\n使用自定义函数:")
print(custom_func)
薪资多维度统计:
            count    sum          mean          std    min    max
department                                                       
HR              3  32577  10859.000000   360.154134  10578  11265
IT              3  30007  10002.333333   508.940403   9426  10390
Sales           4  36918   9229.500000  4143.696377   5466  13322
自定义聚合:
                  salary        bonus     years         employee
                    mean    max   sum      mean min max    count
department                                                      
HR          10859.000000  11265  2966  5.333333   4   7        3
IT          10002.333333  10390  4235  2.333333   1   3        3
Sales        9229.500000  13322  6500  6.750000   3   9        4
使用自定义函数:
             mean_salary  salary_range
department                            
HR          10859.000000           687
IT          10002.333333           964
Sales        9229.500000          7856

2.5 transform() 转换操作

对每个分组进行转换,保持与原DataFrame相同的形状。

In [5]:

# 计算每个员工薪资相对于部门平均的差值
df['dept_avg_salary'] = df.groupby('department')['salary'].transform('mean')
df['salary_diff'] = df['salary'] - df['dept_avg_salary']
print("\n薪资与部门平均差值:")
print(df[['employee', 'department', 'salary', 'dept_avg_salary', 'salary_diff']])
# 计算部门内薪资排名
df['salary_rank'] = df.groupby('department')['salary'].transform('rank', ascending=False)
print("\n部门内薪资排名:")
print(df[['employee', 'department', 'salary', 'salary_rank']].sort_values(['department', 'salary_rank']))
# 标准化(z-score)
df['salary_zscore'] = df.groupby('department')['salary'].transform(lambda x: (x - x.mean()) / x.std())
print("\n部门内薪资标准化:")
print(df[['employee', 'department', 'salary', 'salary_zscore']])
薪资与部门平均差值:
  employee department  salary  dept_avg_salary  salary_diff
0    Alice      Sales   12270      9229.500000  3040.500000
1      Bob      Sales    5860      9229.500000 -3369.500000
2  Charlie         IT   10390     10002.333333   387.666667
3    David         IT   10191     10002.333333   188.666667
4      Eve         HR   10734     10859.000000  -125.000000
5    Frank         HR   11265     10859.000000   406.000000
6    Grace      Sales    5466      9229.500000 -3763.500000
7    Henry         IT    9426     10002.333333  -576.333333
8      Ivy         HR   10578     10859.000000  -281.000000
9     Jack      Sales   13322      9229.500000  4092.500000
部门内薪资排名:
  employee department  salary  salary_rank
5    Frank         HR   11265          1.0
4      Eve         HR   10734          2.0
8      Ivy         HR   10578          3.0
2  Charlie         IT   10390          1.0
3    David         IT   10191          2.0
7    Henry         IT    9426          3.0
9     Jack      Sales   13322          1.0
0    Alice      Sales   12270          2.0
1      Bob      Sales    5860          3.0
6    Grace      Sales    5466          4.0
部门内薪资标准化:
  employee department  salary  salary_zscore
0    Alice      Sales   12270       0.733765
1      Bob      Sales    5860      -0.813163
2  Charlie         IT   10390       0.761713
3    David         IT   10191       0.370705
4      Eve         HR   10734      -0.347074
5    Frank         HR   11265       1.127295
6    Grace      Sales    5466      -0.908247
7    Henry         IT    9426      -1.132418
8      Ivy         HR   10578      -0.780222
9     Jack      Sales   13322       0.987645

2.6 filter() 过滤分组

根据条件筛选分组。

In [6]:

# 筛选员工数大于2的部门
large_depts = df.groupby('department').filter(lambda x: len(x) > 2)
print("\n员工数大于2的部门:")
print(large_depts[['employee', 'department']])
# 筛选平均工资大于8000的部门
high_pay_depts = df.groupby('department').filter(lambda x: x['salary'].mean() > 8000)
print("\n平均工资大于8000的部门:")
print(high_pay_depts[['employee', 'department', 'salary']])
# 筛选薪资方差较小的部门(薪资比较均衡)
stable_depts = df.groupby('department').filter(lambda x: x['salary'].std() < 3000)
print("\n薪资较均衡的部门:")
print(stable_depts[['employee', 'department', 'salary']])
员工数大于2的部门:
  employee department
0    Alice      Sales
1      Bob      Sales
2  Charlie         IT
3    David         IT
4      Eve         HR
5    Frank         HR
6    Grace      Sales
7    Henry         IT
8      Ivy         HR
9     Jack      Sales
平均工资大于8000的部门:
  employee department  salary
0    Alice      Sales   12270
1      Bob      Sales    5860
2  Charlie         IT   10390
3    David         IT   10191
4      Eve         HR   10734
5    Frank         HR   11265
6    Grace      Sales    5466
7    Henry         IT    9426
8      Ivy         HR   10578
9     Jack      Sales   13322
薪资较均衡的部门:
  employee department  salary
2  Charlie         IT   10390
3    David         IT   10191
4      Eve         HR   10734
5    Frank         HR   11265
7    Henry         IT    9426
8      Ivy         HR   10578

2.7 apply() 应用自定义函数

对每个分组应用任意自定义函数。

In [7]:

# 获取每个部门薪资最高的员工
def get_top_earner(group):
    return group.loc[group['salary'].idxmax()]
top_earners = df.groupby('department', group_keys=False).apply(get_top_earner)
print("\n各部门薪资最高员工:")
print(top_earners[['employee', 'department', 'salary']])
# 计算每个部门的薪资分布
def salary_distribution(group):
    return pd.Series({
        'q25': group['salary'].quantile(0.25),
        'q50': group['salary'].median(),
        'q75': group['salary'].quantile(0.75),
        'iqr': group['salary'].quantile(0.75) - group['salary'].quantile(0.25)
    })
dist = df.groupby('department').apply(salary_distribution)
print("\n各部门薪资分布:")
print(dist)
各部门薪资最高员工:
           employee department  salary
department                            
HR            Frank         HR   11265
IT          Charlie         IT   10390
Sales          Jack      Sales   13322
各部门薪资分布:
                q25      q50      q75     iqr
department                                   
HR          10656.0  10734.0  10999.5   343.5
IT           9808.5  10191.0  10290.5   482.0
Sales        5761.5   9065.0  12533.0  6771.5
C:\Users\zhanghc\AppData\Local\Temp\ipykernel_7176\3295751641.py:5: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  top_earners = df.groupby('department', group_keys=False).apply(get_top_earner)
C:\Users\zhanghc\AppData\Local\Temp\ipykernel_7176\3295751641.py:18: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  dist = df.groupby('department').apply(salary_distribution)

2.8 分组迭代

遍历每个分组进行处理。

In [8]:

# 遍历分组
print("\n遍历各部门:")
for name, group in df.groupby('department'):
    print(f"\n部门: {name}")
    print(f"  员工数: {len(group)}")
    print(f"  平均薪资: {group['salary'].mean():.2f}")
    print(f"  最高薪资: {group['salary'].max()}")
    print(f"  最低薪资: {group['salary'].min()}")
# 获取单个分组
sales_dept = df.groupby('department').get_group('Sales')
print("\nSales部门详情:")
print(sales_dept[['employee', 'salary', 'bonus']])
遍历各部门:
部门: HR
  员工数: 3
  平均薪资: 10859.00
  最高薪资: 11265
  最低薪资: 10578
部门: IT
  员工数: 3
  平均薪资: 10002.33
  最高薪资: 10390
  最低薪资: 9426
部门: Sales
  员工数: 4
  平均薪资: 9229.50
  最高薪资: 13322
  最低薪资: 5466
Sales部门详情:
  employee  salary  bonus
0    Alice   12270   1832
1      Bob    5860   1269
6    Grace    5466   1715
9     Jack   13322   1684

2.9 分组描述性统计

快速获取分组描述性统计信息。

In [9]:

# 描述性统计
desc = df.groupby('department')['salary'].describe()
print("\n各部门薪资描述性统计:")
print(desc)
# 多列描述性统计
desc_multi = df.groupby('department')[['salary', 'bonus']].describe()
print("\n多列描述性统计:")
print(desc_multi)
# 使用size()统计分组大小
group_sizes = df.groupby('department').size()
print("\n各部门人数:")
print(group_sizes)
# 使用nunique()统计唯一值数量
unique_genders = df.groupby('department')['gender'].nunique()
print("\n各部门性别种类数:")
print(unique_genders)
各部门薪资描述性统计:
            count          mean          std      min      25%      50%  \
department                                                                
HR            3.0  10859.000000   360.154134  10578.0  10656.0  10734.0   
IT            3.0  10002.333333   508.940403   9426.0   9808.5  10191.0   
Sales         4.0   9229.500000  4143.696377   5466.0   5761.5   9065.0   
                75%      max  
department                    
HR          10999.5  11265.0  
IT          10290.5  10390.0  
Sales       12533.0  13322.0  
多列描述性统计:
           salary                                                        \
            count          mean          std      min      25%      50%   
department                                                                
HR            3.0  10859.000000   360.154134  10578.0  10656.0  10734.0   
IT            3.0  10002.333333   508.940403   9426.0   9808.5  10191.0   
Sales         4.0   9229.500000  4143.696377   5466.0   5761.5   9065.0   
                             bonus                                            \
                75%      max count         mean         std     min      25%   
department                                                                     
HR          10999.5  11265.0   3.0   988.666667  279.321201   776.0   830.50   
IT          10290.5  10390.0   3.0  1411.666667  548.285814   843.0  1149.00   
Sales       12533.0  13322.0   4.0  1625.000000  245.741056  1269.0  1580.25   
               50%      75%     max  
department                           
HR           885.0  1095.00  1305.0  
IT          1455.0  1696.00  1937.0  
Sales       1699.5  1744.25  1832.0  
各部门人数:
department
HR       3
IT       3
Sales    4
dtype: int64
各部门性别种类数:
department
HR       2
IT       1
Sales    2
Name: gender, dtype: int64

2.10 分组与透视表结合

groupby与pivot_table的对比使用。

In [10]:

# 使用groupby创建透视效果
pivot_groupby = df.groupby(['department', 'gender'])['salary'].mean().unstack()
print("\nGroupBy创建的透视表:")
print(pivot_groupby)
# 使用pivot_table
pivot_table = df.pivot_table(values='salary', index='department', columns='gender', aggfunc='mean')
print("\nPivot Table:")
print(pivot_table)
# 添加边际值
pivot_with_margins = df.pivot_table(values='salary', index='department', columns='gender', aggfunc='mean', margins=True)
print("\n带边际值的透视表:")
print(pivot_with_margins)
GroupBy创建的透视表:
gender            F             M
department                       
HR          10656.0  11265.000000
IT              NaN  10002.333333
Sales        8868.0   9591.000000
Pivot Table:
gender            F             M
department                       
HR          10656.0  11265.000000
IT              NaN  10002.333333
Sales        8868.0   9591.000000
带边际值的透视表:
gender            F             M           All
department                                     
HR          10656.0  11265.000000  10859.000000
IT              NaN  10002.333333  10002.333333
Sales        8868.0   9591.000000   9229.500000
All          9762.0  10075.666667   9950.200000

3. 常见应用场景总结

  1. 部门统计
    :按部门、地区等维度统计员工数、平均工资等。
  2. 时间聚合
    :按年、月、日聚合销售数据。
  3. 异常检测
    :通过transform计算每个值相对于组平均的偏差。
  4. 数据标准化
    :按组进行z-score标准化。
  5. 分组排名
    :计算每个元素在组内的排名。
  6. 筛选分组
    :只保留符合条件的分组进行后续分析。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-04-16 22:46:12 HTTP/2.0 GET : https://f.mffb.com.cn/a/485571.html
  2. 运行时间 : 0.257112s [ 吞吐率:3.89req/s ] 内存消耗:5,621.22kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=da7e17bdf0d41a9994030850d14107f5
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000995s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001572s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000762s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000686s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001367s ]
  6. SELECT * FROM `set` [ RunTime:0.000607s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001431s ]
  8. SELECT * FROM `article` WHERE `id` = 485571 LIMIT 1 [ RunTime:0.029519s ]
  9. UPDATE `article` SET `lasttime` = 1776350773 WHERE `id` = 485571 [ RunTime:0.001579s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000983s ]
  11. SELECT * FROM `article` WHERE `id` < 485571 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001968s ]
  12. SELECT * FROM `article` WHERE `id` > 485571 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001147s ]
  13. SELECT * FROM `article` WHERE `id` < 485571 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.011737s ]
  14. SELECT * FROM `article` WHERE `id` < 485571 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.026058s ]
  15. SELECT * FROM `article` WHERE `id` < 485571 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.012438s ]
0.261062s