Files
nexus/wiki/entities/Pandas.md
2026-05-03 05:42:12 +08:00

1.7 KiB
Raw Blame History

title, type, tags, sources, last_updated
title type tags sources last_updated
Pandas entity
python
data-analysis
library
testing-test-results-analyzer
2026-04-28

Aliases

  • pandas
  • pandas DataFrame
  • pandas Series

Definition

Pandas 是 Python 的核心数据分析库,提供高性能、易用的数据结构和数据分析工具,在测试结果分析中用于读取、处理和转换测试数据。

Usage in Test Analysis (from TestResultsAnalyzer)

import pandas as pd

# 读取测试结果数据
self.test_results = pd.read_json(test_results_path)

# 分析测试覆盖缺口
for file_path, file_coverage in uncovered_files.items():
    if file_coverage['lines']['pct'] < 80:
        gap_analysis.append({
            'file': file_path,
            'coverage': file_coverage['lines']['pct'],
            'risk_level': self._assess_file_risk(file_path, file_coverage)
        })

Core Data Structures

  • Series:一维标记数组,类似带索引的列。
  • DataFrame:二维表格数据结构,类似电子表格或 SQL 表。
  • Panel:三维数据结构(已弃用)。

Key Methods for Test Analysis

  • read_json() / read_csv():加载测试结果数据。
  • groupby():按类别(功能/性能/安全/集成)分组分析。
  • describe():生成描述性统计摘要。
  • merge() / join():跨数据源关联分析。

Connections