当前位置:首页>python>Python数据处理中的缺失值处理:从理论到实践的完整指南

Python数据处理中的缺失值处理:从理论到实践的完整指南

  • 2026-01-20 18:40:13
Python数据处理中的缺失值处理:从理论到实践的完整指南

👋 大家好,我是【Python数智工坊】的小编,从上海回归二线城市深耕多年的央企算法工程师,专注数据分析、机器学习、运筹优化与AI实战。

今天要和大家分享的是 缺失值处理,这是一个在数据分析/数据处理 中非常实用的 方法。

⏱️ 预计阅读:30分钟

💡 阅读建议:建议先点赞收藏,方便后续查阅!

让我们开始吧!👇


在现实世界的数据分析项目中,缺失值(Missing Values)几乎无处不在。无论是用户未填写的问卷字段、传感器故障导致的数据空白,还是数据整合过程中的信息丢失,缺失值的存在都会对模型性能、统计推断和业务决策产生深远影响。据统计,数据科学家约有60%的时间花费在数据清洗和预处理上,而缺失值处理正是其中最核心的环节之一。

本文将深入探讨Python生态系统中处理缺失值的各种方法,从基础的删除和填充策略到高级的插补算法,为你构建一套完整的缺失值处理知识体系。

缺失值的类型与成因分析

缺失值的三种机制

在着手处理缺失值之前,理解其产生机制至关重要,这直接影响处理策略的选择:

完全随机缺失(MCAR, Missing Completely At Random):缺失与任何变量都无关,纯粹随机发生。例如,实验设备随机故障导致的数据丢失。这种情况下,删除缺失值不会引入偏差。

随机缺失(MAR, Missing At Random):缺失与观测到的变量相关,但与未观测到的值无关。例如,年轻用户更倾向于不填写收入信息,此时缺失与年龄相关但与实际收入无关。这种情况适合使用插补方法。

非随机缺失(MNAR, Missing Not At Random):缺失与未观测到的值本身相关。例如,高收入者故意隐瞒收入信息。这是最难处理的情况,需要领域知识辅助。

Python中缺失值的表示形式

Python的不同库对缺失值有不同的表示方式:

import numpy as npimport pandas as pd# NumPy使用np.nanarr = np.array([1.0, np.nan, 3.0])# Pandas支持多种缺失值表示df = pd.DataFrame({'A': [1, np.nan, 3],'B': [4None6],'C': [7, pd.NA, 9],'D': ['x''''z']  # 空字符串不是标准缺失值})

缺失值的检测与可视化

基础检测方法

在处理缺失值之前,必须先全面了解数据中缺失的分布情况:

import pandas as pdimport numpy as np# 创建示例数据df = pd.DataFrame({'age': [25, np.nan, 3542, np.nan, 28],'income': [5000060000, np.nan, 8000055000, np.nan],'education': ['Bachelor''Master', np.nan, 'PhD''Bachelor''Master']})# 检测缺失值print(df.isnull())  # 返回布尔矩阵print(df.isnull().sum())  # 每列缺失值数量print(df.isnull().sum() / len(df) * 100)  # 缺失值百分比# 检测任一行或列是否存在缺失值print(df.isnull().any(axis=1))  # 按行检测print(df.isnull().any(axis=0))  # 按列检测

高级可视化技术

可视化能够揭示缺失值的模式和潜在规律:

import missingno as msnoimport matplotlib.pyplot as pltimport seaborn as sns# 使用missingno库进行可视化msno.matrix(df)  # 矩阵图,显示缺失值分布msno.bar(df)  # 柱状图,显示每列完整度msno.heatmap(df)  # 热力图,显示缺失值相关性msno.dendrogram(df)  # 树状图,显示缺失值聚类# 自定义热力图plt.figure(figsize=(106))sns.heatmap(df.isnull(), cbar=False, yticklabels=False, cmap='viridis')plt.title('Missing Values Heatmap')plt.show()

删除策略:简单但需谨慎

行删除(Listwise Deletion)

当缺失值比例较小且符合MCAR机制时,删除包含缺失值的行是最直接的方法:

# 删除任何包含缺失值的行df_cleaned = df.dropna()# 删除所有值都缺失的行df_cleaned = df.dropna(how='all')# 至少需要n个非缺失值才保留该行df_cleaned = df.dropna(thresh=2)# 仅考虑特定列的缺失值df_cleaned = df.dropna(subset=['age''income'])

优点:实现简单,不引入额外假设。

缺点:可能丢失大量信息,特别是当缺失值广泛分布时;如果缺失不是MCAR,会引入偏差。

列删除(Column Deletion)

当某列缺失值过多(通常>40%)且该列信息量有限时,可考虑删除整列:

# 计算缺失比例并删除高缺失列threshold = 0.4missing_ratio = df.isnull().sum() / len(df)cols_to_drop = missing_ratio[missing_ratio > threshold].indexdf_cleaned = df.drop(columns=cols_to_drop)# 更灵活的删除策略defdrop_high_missing_cols(df, threshold=0.5):"""删除缺失率超过阈值的列"""    missing_pct = df.isnull().mean()return df.loc[:, missing_pct <= threshold]

填充策略:用已知估计未知

统计量填充

使用描述性统计量填充是最常见的方法:

# 均值填充(适用于数值型且近似正态分布)df['age'].fillna(df['age'].mean(), inplace=True)# 中位数填充(对异常值更鲁棒)df['income'].fillna(df['income'].median(), inplace=True)# 众数填充(适用于分类变量)df['education'].fillna(df['education'].mode()[0], inplace=True)# 使用fillna的method参数df.fillna(method='ffill')  # 前向填充df.fillna(method='bfill')  # 后向填充# 分组填充(按类别计算统计量)df['income'] = df.groupby('education')['income'].transform(lambda x: x.fillna(x.median()))

常数填充

在某些场景下,使用特定常数填充更合理:

# 使用0填充df.fillna(0)# 使用特定值填充不同列fill_values = {'age'0'income': df['income'].median(), 'education''Unknown'}df.fillna(value=fill_values)# 对于分类变量,创建"缺失"类别df['education'].fillna('Missing', inplace=True)

插值方法

对于时间序列或有序数据,插值能够保留数据的趋势性:

# 线性插值df['temperature'] = df['temperature'].interpolate(method='linear')# 多项式插值df['value'] = df['value'].interpolate(method='polynomial', order=2)# 时间序列插值df.index = pd.to_datetime(df.index)df['price'] = df['price'].interpolate(method='time')# 样条插值(更平滑)df['signal'] = df['signal'].interpolate(method='spline', order=3)# 限制插值范围df['data'] = df['data'].interpolate(limit=3)  # 最多插值3个连续缺失值

高级插补算法:机器学习驱动

K近邻插补(KNN Imputation)

KNN插补利用样本间的相似性,用最近邻样本的值进行加权平均:

from sklearn.impute import KNNImputer# 创建KNN插补器imputer = KNNImputer(n_neighbors=5, weights='distance')# 应用插补df_imputed = pd.DataFrame(    imputer.fit_transform(df[['age''income']]),    columns=['age''income'])# 自定义距离度量from sklearn.impute import KNNImputerimputer = KNNImputer(    n_neighbors=3,    weights='uniform',  # 或'distance'    metric='nan_euclidean'# 处理缺失值的欧氏距离)

优点:考虑了特征间的关系,对非线性关系有效。

缺点:计算成本高,对高维数据效果下降(维度灾难),需要特征标准化。

迭代插补(MICE)

多重插补链式方程(MICE)是一种迭代方法,将每个缺失特征建模为其他特征的函数:

from sklearn.experimental import enable_iterative_imputerfrom sklearn.impute import IterativeImputerfrom sklearn.ensemble import RandomForestRegressor# 基础迭代插补imputer = IterativeImputer(random_state=42, max_iter=10)df_imputed = pd.DataFrame(    imputer.fit_transform(df[['age''income''years_employed']]),    columns=['age''income''years_employed'])# 使用随机森林作为估计器imputer = IterativeImputer(    estimator=RandomForestRegressor(n_estimators=10, random_state=42),    max_iter=10,    random_state=42)df_imputed = imputer.fit_transform(df.select_dtypes(include=[np.number]))

原理

  1. 初始化所有缺失值(如使用均值)
  2. 迭代每个有缺失的特征:
    • 将该特征作为目标变量
    • 用其他特征训练回归模型
    • 预测并填充该特征的缺失值
  3. 重复迭代直到收敛或达到最大迭代次数

深度学习插补(Autoencoder)

自编码器可以学习数据的低维表示,用于复杂的缺失值插补:

import tensorflow as tffrom tensorflow import keras# 构建去噪自编码器defcreate_autoencoder(input_dim):    input_layer = keras.layers.Input(shape=(input_dim,))# 编码器    encoded = keras.layers.Dense(64, activation='relu')(input_layer)    encoded = keras.layers.Dense(32, activation='relu')(encoded)# 解码器    decoded = keras.layers.Dense(64, activation='relu')(encoded)    decoded = keras.layers.Dense(input_dim, activation='linear')(decoded)    autoencoder = keras.Model(input_layer, decoded)    autoencoder.compile(optimizer='adam', loss='mse')return autoencoder# 准备数据(将缺失值暂时填充为0)df_filled = df.fillna(0)X = df_filled.values# 训练模型autoencoder = create_autoencoder(X.shape[1])autoencoder.fit(X, X, epochs=50, batch_size=32, verbose=0)# 预测(插补)df_imputed = pd.DataFrame(    autoencoder.predict(X),    columns=df.columns)

专业库与工具集成

Scikit-learn的SimpleImputer

Scikit-learn提供了标准化的插补接口,便于集成到机器学习流程中:

from sklearn.impute import SimpleImputerfrom sklearn.pipeline import Pipelinefrom sklearn.preprocessing import StandardScalerfrom sklearn.linear_model import LogisticRegression# 数值型插补器num_imputer = SimpleImputer(strategy='median')# 分类型插补器cat_imputer = SimpleImputer(strategy='most_frequent')# 创建完整的预处理管道from sklearn.compose import ColumnTransformernumeric_features = ['age''income']categorical_features = ['education''occupation']preprocessor = ColumnTransformer(    transformers=[        ('num', Pipeline([            ('imputer', SimpleImputer(strategy='median')),            ('scaler', StandardScaler())        ]), numeric_features),        ('cat', Pipeline([            ('imputer', SimpleImputer(strategy='constant', fill_value='missing')),        ]), categorical_features)    ])# 完整的建模流程model = Pipeline([    ('preprocessor', preprocessor),    ('classifier', LogisticRegression())])

Pandas的高级功能

Pandas提供了灵活的缺失值处理功能:

# 使用interpolate进行复杂插值df['values'] = df['values'].interpolate(    method='polynomial',    order=2,    limit_direction='both',    limit_area='inside')# 结合groupby进行分组插补df['salary'] = df.groupby(['department''level'])['salary'].transform(lambda x: x.fillna(x.median()))# 使用replace处理特殊值df.replace([np.inf, -np.inf], np.nan, inplace=True)df.replace('', np.nan, inplace=True)# 链式填充策略df['score'] = (df['score']    .fillna(df.groupby('class')['score'].transform('median'))    .fillna(df['score'].median()))

专业插补库:fancyimpute

fancyimpute提供了多种先进的插补算法:

from fancyimpute import SoftImpute, MatrixFactorization# 软阈值矩阵补全imputer = SoftImpute(verbose=False)df_imputed = pd.DataFrame(    imputer.fit_transform(df.values),    columns=df.columns)# 矩阵分解插补imputer = MatrixFactorization(rank=10)df_imputed = imputer.fit_transform(df.values)

缺失值处理的最佳实践

评估插补质量

插补后必须评估质量,确保不引入过多偏差:

from sklearn.model_selection import cross_val_scorefrom sklearn.ensemble import RandomForestClassifier# 创建人工缺失值进行验证defevaluate_imputation(df, target_col, missing_rate=0.2):"""评估插补方法的性能"""    df_complete = df.dropna()# 随机创建缺失值    mask = np.random.rand(len(df_complete)) < missing_rate    df_test = df_complete.copy()    original_values = df_test.loc[mask, target_col].copy()    df_test.loc[mask, target_col] = np.nan# 应用插补from sklearn.impute import KNNImputer    imputer = KNNImputer(n_neighbors=5)    df_imputed = imputer.fit_transform(df_test.select_dtypes(include=[np.number]))# 计算误差    imputed_values = df_imputed[mask, df_test.columns.get_loc(target_col)]    mae = np.mean(np.abs(original_values - imputed_values))    rmse = np.sqrt(np.mean((original_values - imputed_values)**2))return {'MAE': mae, 'RMSE': rmse}

处理流程建议

构建系统化的缺失值处理流程:

classMissingValueHandler:"""缺失值处理的完整工作流"""def__init__(self, df):        self.df = df.copy()        self.report = {}defanalyze(self):"""分析缺失值情况"""        self.report['total_missing'] = self.df.isnull().sum().sum()        self.report['missing_by_column'] = self.df.isnull().sum()        self.report['missing_percentage'] = (self.df.isnull().sum() / len(self.df) * 100)return self.reportdefhandle_high_missing_cols(self, threshold=0.5):"""删除高缺失列"""        missing_pct = self.df.isnull().mean()        cols_to_drop = missing_pct[missing_pct > threshold].index.tolist()        self.df.drop(columns=cols_to_drop, inplace=True)        self.report['dropped_columns'] = cols_to_dropreturn selfdefimpute_numerical(self, strategy='median', columns=None):"""插补数值列"""if columns isNone:            columns = self.df.select_dtypes(include=[np.number]).columnsfrom sklearn.impute import SimpleImputer        imputer = SimpleImputer(strategy=strategy)        self.df[columns] = imputer.fit_transform(self.df[columns])return selfdefimpute_categorical(self, strategy='most_frequent', columns=None):"""插补分类列"""if columns isNone:            columns = self.df.select_dtypes(include=['object''category']).columnsfrom sklearn.impute import SimpleImputer        imputer = SimpleImputer(strategy=strategy)        self.df[columns] = imputer.fit_transform(self.df[columns])return selfdefget_cleaned_data(self):"""返回清洗后的数据"""return self.df# 使用示例handler = MissingValueHandler(df)report = handler.analyze()cleaned_df = (handler    .handle_high_missing_cols(threshold=0.6)    .impute_numerical(strategy='median')    .impute_categorical(strategy='most_frequent')    .get_cleaned_data())

领域知识的重要性

不同业务场景需要不同的处理策略:

# 金融数据:缺失可能意味着零交易df['transaction_amount'].fillna(0, inplace=True)# 医疗数据:某些缺失可能有临床意义df['test_result_missing'] = df['test_result'].isnull().astype(int)df['test_result'].fillna(df['test_result'].median(), inplace=True)# 时间序列:使用前向填充保持连续性df['sensor_reading'].fillna(method='ffill', limit=5, inplace=True)# 推荐系统:缺失评分可能表示不感兴趣df['rating'].fillna(-1, inplace=True)  # 使用特殊标记

性能优化与大数据处理

内存优化技巧

处理大规模数据时,内存管理至关重要:

# 减少内存占用defreduce_mem_usage(df):"""优化DataFrame的内存使用"""    start_mem = df.memory_usage().sum() / 1024**2for col in df.columns:        col_type = df[col].dtypeif col_type != object:            c_min = df[col].min()            c_max = df[col].max()if str(col_type)[:3] == 'int':if c_min > np.iinfo(np.int8).min and c_max < np.iinfo(np.int8).max:                    df[col] = df[col].astype(np.int8)elif c_min > np.iinfo(np.int16).min and c_max < np.iinfo(np.int16).max:                    df[col] = df[col].astype(np.int16)elif c_min > np.iinfo(np.int32).min and c_max < np.iinfo(np.int32).max:                    df[col] = df[col].astype(np.int32)else:if c_min > np.finfo(np.float32).min and c_max < np.finfo(np.float32).max:                    df[col] = df[col].astype(np.float32)    end_mem = df.memory_usage().sum() / 1024**2    print(f'Memory usage decreased from {start_mem:.2f} MB to {end_mem:.2f} MB 'f'({100 * (start_mem - end_mem) / start_mem:.1f}% reduction)')return df# 分块处理大文件chunk_size = 10000chunks = []for chunk in pd.read_csv('large_file.csv', chunksize=chunk_size):# 处理每个块    chunk.fillna(chunk.median(), inplace=True)    chunks.append(chunk)df = pd.concat(chunks, ignore_index=True)

并行处理加速

利用多核CPU加速缺失值处理:

from multiprocessing import Poolimport numpy as npdefparallel_impute(df, n_cores=4):"""并行处理缺失值插补"""# 分割数据    df_split = np.array_split(df, n_cores)# 定义插补函数defimpute_chunk(chunk):from sklearn.impute import KNNImputer        imputer = KNNImputer(n_neighbors=5)return pd.DataFrame(            imputer.fit_transform(chunk),            columns=chunk.columns,            index=chunk.index        )# 并行处理with Pool(n_cores) as pool:        df_imputed = pd.concat(pool.map(impute_chunk, df_split))return df_imputed

结语

缺失值处理从来不是一个纯粹的技术问题,而是需要将统计学原理、机器学习算法、领域知识和工程实践有机结合的综合性任务。没有放之四海而皆准的"最佳方法",只有针对特定场景的"最优策略"。

在实践中,建议遵循以下原则:

理解先于行动:在处理之前,必须深入分析缺失值的类型、分布和成因,这决定了后续策略的有效性。

简单优于复杂:优先尝试简单方法(如中位数填充),只有在确实需要时才引入复杂算法(如MICE或深度学习)。

验证胜于假设:通过交叉验证、人工缺失实验等方法,量化评估不同插补策略的效果。

记录便于追溯:详细记录处理过程和决策依据,确保数据处理的可重复性和可审计性。

迭代促进优化:将缺失值处理视为迭代过程,在模型训练和业务反馈中持续优化策略。

掌握缺失值处理技术,你就拥有了将"不完美数据"转化为"可用信息"的能力,这是每一位数据科学家的必修课。希望本文能够为你的数据处理工作提供实用的指导和启发。


【Python数智工坊】看完记得点赞👍,方便下次找到我!

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-08 15:24:16 HTTP/2.0 GET : https://f.mffb.com.cn/a/464049.html
  2. 运行时间 : 2.458281s [ 吞吐率:0.41req/s ] 内存消耗:5,365.62kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=2052e1d6ac28ab12a7bbd618f0fadc53
  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.000542s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000850s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.100605s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.100669s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000562s ]
  6. SELECT * FROM `set` [ RunTime:0.100722s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001683s ]
  8. SELECT * FROM `article` WHERE `id` = 464049 LIMIT 1 [ RunTime:0.022671s ]
  9. UPDATE `article` SET `lasttime` = 1770535456 WHERE `id` = 464049 [ RunTime:1.855627s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.005235s ]
  11. SELECT * FROM `article` WHERE `id` < 464049 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.002156s ]
  12. SELECT * FROM `article` WHERE `id` > 464049 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.015540s ]
  13. SELECT * FROM `article` WHERE `id` < 464049 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.057836s ]
  14. SELECT * FROM `article` WHERE `id` < 464049 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.081166s ]
  15. SELECT * FROM `article` WHERE `id` < 464049 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.041232s ]
2.459746s