### 读入(数据提取) 读入 28+ 统计软件及临床试验数据格式(CDISC ODM/EpiData/EpiInfo/Excel/EViews/Feather/FST/GraphPad Prism/Gretl/HDF5/HTML/jamovi/JMP/JSON/MATLAB/Minitab/ODS/ORC/Parquet/R/SAS/SPSS/Stata/Weka ARFF/XML),转换为 Python/pandas DataFrame,并在不同格式之间**双向转换**,100% 保留变量标签、值标签
统计数据-传输/统计数据格式转换器 + 数据/传输器 + / 荣誉数据/传输器 行业标准 / 语言政策 + + + + + + + + + + + + + +
功能概述
统计数据-传输/统计数据格式转换器 + 数据/传输器 + / 荣誉数据/传输器 行业标准 / 语言政策 + + + + + + + + + + + + + + 是一项面向实际任务的技能。它将相关步骤、工具调用和结果整理方式集中到统一流程中,帮助使用者更快完成目标并减少重复操作。
核心要点
- 使用时应结合输入条件选择合适的执行方式,核对必要参数、依赖环境与输出内容,并按原始要求处理异常情况。
- 该技能适合需要稳定复用相关能力的场景,可作为自动化工作流的一部分,也便于后续检查、调整和扩展。
- 从功能定位来看,该技能强调把分散的操作要求整理成清晰、可复用的处理流程,使用户能够围绕既定目标快速准备输入、选择执行方式并获得结构化结果。
使用与执行
实际使用前应先确认任务范围、数据来源、运行环境、必要权限和关键参数,再依据技能说明逐步执行;若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。
结果检查与注意事项
执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;涉及批量任务时,还应保存进度,避免中断后重复操作。
statdata-transfer / 统计数据格式转换器
致敬 Stat/Transfer — 业界格式转换标杆 / Honoring Stat/Transfer — the industry standard
Language Policy / 语言策略
- 默认英文;检测到中文环境时切换为中文提示。
- 常用模块备英文 + 中文两套;文档标题(不区分语言者)采用「英 / 中」顺序双语。
- 复杂 / 少用模块可暂只英文。
Core Capabilities / 核心能力
| Ability / 能力 | Description / 说明 |
|---|---|
| Read / 读入 | SPSS/Stata/SAS/R … full metadata; text/JSON/detect-only keep subset / 统计二进制格式完整保留元数据;文本/JSON 保留子集;12 种专有格式探测降级 |
| Convert / 转存 | Inter-convert most stats formats: SPSS↔Stata↔R↔SAS XPT↔… / 多数统计格式可互转(部分受限于规范) |
| Embed / 元数据嵌入 | Labels embed in Parquet/Feather/HDF5/JSON via schema.metadata / 标签嵌入 Arrow schema.metadata |
| Warn / 丢失警告 | Auto-detect metadata loss per conversion path / 自动检测并报告元数据损失 |
Supported Formats / 支持格式
50+ formats, sorted alphabetically. 按字母排序。
| Format 格式 | Extension 扩展名 | Meta Preserve 元数据保留 |
|---|---|---|
| CDISC ODM | .odm |
⚠️ Clinical data only |
| dBASE / FoxPro | .dbf |
⚠️ Read+Write, uppercase names |
| EpiData | .rec |
⚠️ Via R |
| EpiInfo | .prj .xml |
✅ XML structure |
| Excel | .xlsx .xls .xlsm |
⚠️ Extra sheet for labels; merged-cell fill |
| EViews | .wf1 .wf2 |
⚠️ JSON structure |
| Feather | .feather .arrow |
✅ Via schema |
| FST | .fst |
✗ Detect-only (proprietary format) |
| GraphPad Prism | .pzfx .pz |
⚠️ Multi-table |
| Gretl | .gdt .gdtb |
✅ String-tables |
| HDF5 | .h5 .hdf5 |
⚠️ Hierarchy + attribute labels |
| HTML | .html |
⚠️ Tables only |
| jamovi | .omv |
✅ JSON analysis |
| JMP | .jmp |
⚠️ Multi-table |
| JSON | .json |
✅ stat-full-meta |
| MATLAB | .mat |
⚠️ v7.3+ via h5py fallback |
| Mathematica | .wdx |
⚠️ Best-effort XML |
| Minitab | .mtw .mpj |
⚠️ Via R |
| MS Access | .mdb .accdb |
⚠️ Multi-table; needs system driver |
| ODS | .ods |
⚠️ Data only |
| ORC | .orc |
✅ Via schema |
| Origin | .opju .oggu |
⚠️ Best-effort |
| Parquet | .parquet |
✅ Via schema; partitioned datasets |
| R | .rda .rds .rdata |
✅ pyreadr; R-interpreter fallback opt-in (allow_r_exec) |
| SAS | .sas7bdat .xpt .sas7bcat |
✅ |
| SPSS | .sav .zsav .por |
✅ |
| Stata | .dta |
✅ |
| Weka ARFF | .arff |
✅ Nominal mapping |
| XML | .xml |
⚠️ Structure preserved |
✅=Full · ⚠️=Partial/conditional · ✗=Not preserved
12 detect-only formats (SAS CPORT
.cpt, Statistica.sta, OxMetrics.in7, SYSTAT.sys/.syd, Paradox.db/.px, LIMDEP.lpw, NCSS.ncss) give clear export guidance — see README.
Return Structure / 返回结构
{
"dataframe": pd.DataFrame,
"metadata": {
"file_format": "spss_sav",
"row_count": 100, "column_count": 10,
"variable_labels": {"q1": "Question 1"},
"value_labels": {"q1": {1: "Yes", 2: "No"}},
# ... 全部元数据 / all metadata fields
},
"warnings": [],
"column_report": {"q1": {"source_type": "int", "pandas_dtype": "int64"}},
}
Quick Start / 快速开始
# Check environment / 检查环境 python scripts/check_env.py --install # Run via WorkBuddy (bilingual, auto-detects your language) > convert data.sav to .dta > read data.sav and show metadata > 把 data.sav 转成 .dta 并保留变量标签
For complete code examples, see
references/usage_examples.py. 完整代码示例见references/usage_examples.py。
Dependencies / 依赖
requires:
bins: [python3]
packages:
core: [pyreadstat>=1.3.5,<2, pyreadr>=0.4,<0.5, pandas>=2.0,<3]
extended: [openpyxl, xlrd, scipy, h5py, pyarrow, lxml, odfpy, tableauhyperapi, dbfread, dbf, pyodbc]
Full list:
requirements.txt/ 完整列表见requirements.txt
Detailed Docs / 详细文档
- English:
README.md— format limits, strategies, encoding, extension guide - 中文:
README_ZH.md— 格式限制、读入策略、编码注意事项、扩展指南
Security / 安全
- All R-invoking paths are opt-in & sandboxed by default / 所有调用 R 的路径默认隔离、需显式开启: reading
.rda/.rds/.RData(readRDS()/load()), reading Minitab.mtw/.mpjand EpiData.rec(foreign::read.mtb()/read.epiinfo()), and writing R formats (.rda/.rds) are disabled by default. They only run when you explicitly passallow_r_exec=Trueon a TRUSTED file. Pure-Python parsers (pyreadr,mtbpy) are tried first and never execute code. - No silent R fallback / 无静默 R 回退: If the pure-Python parser fails and
allow_r_execis not set, the skill raises a clear error instead of silently launching R — eliminating the risk of executing embedded code from untrusted files. - R scripts are static templates / R 脚本为静态模板: When the opt-in R path is used, all R scripts are fully static templates; user inputs are passed only as CLI args (
commandArgs(trailingOnly=TRUE)viajsonlite) — never concatenated into executable R code. Random temp filenames; no fixed paths. - R bridge writes a temp CSV / R 桥接写临时 CSV: When R is used (opt-in), converted data is materialized to a temporary CSV on disk before being read back; the temp file is deleted immediately after use, but on crash or via backup/indexing tools it could briefly persist — avoid processing highly sensitive data through R-backed formats.
- No destructive writes / 无破坏性写入: Writing an existing
.hyperfirst writes to a temp file; only after success is the existing file rotated to(prior.bak .bakdemoted to.bak.1, never silently deleted), then atomically swapped in. On write failure the original is untouched. - Pinned dependencies / 依赖已固定版本: Core deps carry upper-bound pins (
pandas,pyreadstat,pyreadr) — seerequirements.txt. - Optional install / 可选安装:
python scripts/check_env.py --installonly runs on explicit request. - Permissions required / 所需权限: Read the input file; write the output file to a path you specify. No network access unless you explicitly request package installation. No destructive writes — existing
.hyperoutputs are backed up to.bakbefore overwrite. - Scope / 范围: Statistical data formats only. Text/JSON formats preserve metadata subset only — see «Format Limits» in README.
License / 许可证
MIT. See LICENSE. / 详见 LICENSE。
热门AI工具
相关专题
本专题从实际API接口调试场景出发,讲解Postman身份认证的完整配置流程,包括常见认证协议介绍、授权参数设置、访问令牌填写、OAuth 2.0授权及认证失败排查,帮助用户正确完成接口授权与访问验证。
0
2026.11.06
围绕Postman HTTP请求头配置展开,讲解Headers选项的具体使用方式,包括Key和Value参数填写、请求头信息添加、常见Header字段设置及请求头修改方法,帮助用户解决接口调试过程中遇到的请求头配置问题。
0
2026.11.06
详细介绍Postman接口请求的创建与发送方法,涵盖GET和POST请求、URL配置、请求参数、Headers请求头、Body请求体设置以及响应结果查看,帮助用户掌握Postman接口请求的完整操作流程。
0
2026.11.06
DBeaver数据导入专题,整理Excel、CSV、SQL、TXT等常见文件的数据导入方法,涵盖目标数据库选择、数据表创建、字段映射、数据类型设置及导入参数配置等操作,帮助用户将本地文件中的数据写入数据库,并了解批量导入、重复数据处理和导入失败等常见问题的解决方法。
0
2026.11.05
DBeaver安全防护专题,围绕数据库连接安全、账号密码保护和访问权限管理展开,整理SSL/TLS加密连接、SSH隧道、数据库凭据保存及证书验证等配置方法,同时介绍敏感信息保护、远程连接风险和高权限账号使用等注意事项,帮助用户提高数据库日常管理的安全性。
0
2026.11.05
本专题聚焦DBeaver数据库连接配置与管理,覆盖从新建连接、选择数据库类型到填写连接参数和验证连接的完整流程。针对MySQL、PostgreSQL、SQL Server等常见数据库,整理相应的连接设置方法,并提供驱动缺失、认证失败和连接异常等问题的排查方向。
0
2026.11.04
本专题围绕XORM框架的结构体映射展开,说明表名与字段的命名策略、xorm标签常用属性、主键自增与时间字段自动填充,并演示Sync2自动建表、增量字段升级、索引声明与反向生成结构体的完整流程。
0
2026.11.04
本专题聚焦XORM框架的配置与连接环节,拆解MySQL、PostgreSQL、SQLite、SQL Server的DSN写法与驱动选择,讲清连接池参数、多数据源拆分、读写分离与超时重连的处理方式,并补充容器与兼容数据库的适配经验。
0
2026.11.04
本专题聚焦XORM框架的配置与连接环节,拆解MySQL、PostgreSQL、SQLite、SQL Server的DSN写法与驱动选择,讲清连接池参数、多数据源拆分、读写分离与超时重连的处理方式,并补充容器与兼容数据库的适配经验。
0
2026.11.04
热门下载
相关下载
精品课程
共6课时 | 12.1万人学习
共79课时 | 161.7万人学习
共6课时 | 54.7万人学习
最新文章