Skip to content

quietdog/xiaoming-datahelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xiaoming DataHelper

一个简单的数据处理工具包,帮助你轻松处理 CSV 文件数据。

功能特点

  • 支持相对路径和绝对路径的 CSV 文件读取
  • 提供基本的数据统计功能
  • 简单易用的 API 设计
  • 完整的类型提示支持

安装

pip install xiaoming-datahelper

快速开始

from datahelper import CSVReader, DataProcessor

# 读取 CSV 文件
reader = CSVReader("data.csv")
data = reader.read()

# 处理数据
processor = DataProcessor(data)
stats = processor.calculate_stats("age")
print(stats)

使用示例

使用相对路径

from datahelper import CSVReader

# 使用相对路径(基于当前工作目录)
reader = CSVReader("data/sales.csv")
data = reader.read()

使用绝对路径

from datahelper import CSVReader

# 使用绝对路径
reader = CSVReader("/absolute/path/to/data.csv")
data = reader.read()

指定基准目录

from datahelper import CSVReader

# 指定基准目录
reader = CSVReader("data/sales.csv", base_dir="/path/to/project")
data = reader.read()

数据统计

from datahelper import CSVReader, DataProcessor

# 读取数据
reader = CSVReader("data.csv")
data = reader.read()

# 计算统计信息
processor = DataProcessor(data)
age_stats = processor.calculate_stats("age")
salary_stats = processor.calculate_stats("salary")

print("年龄统计:", age_stats)
print("薪资统计:", salary_stats)

开发指南

环境设置

  1. 克隆仓库:
git clone https://github.com/yourusername/xiaoming-datahelper.git
cd xiaoming-datahelper
  1. 创建虚拟环境:
python -m venv venv
source venv/bin/activate  # Windows 使用: venv\Scripts\activate
  1. 安装开发依赖:
pip install -e ".[dev]"

开发工具

项目提供了多个便捷的脚本:

  1. 清理项目:
./scripts/clean.sh
  1. 构建包:
./scripts/build.sh
  1. 上传到 PyPI:
./scripts/upload.sh

运行测试

pytest tests/

项目结构

datahelper/
├── src/
│   └── datahelper/
│       ├── __init__.py
│       ├── core/
│       │   ├── __init__.py
│       │   ├── reader.py
│       │   └── processor.py
│       └── utils/
│           ├── __init__.py
│           └── helpers.py
├── tests/
│   ├── __init__.py
│   ├── test_reader.py
│   └── test_processor.py
├── examples/
│   └── basic_usage.py
└── scripts/
    ├── clean.py
    ├── build.py
    └── upload.py

贡献指南

  1. Fork 项目
  2. 创建特性分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 创建 Pull Request

许可证

本项目采用 MIT 许可证 - 详见 LICENSE 文件

作者

致谢

  • 感谢所有贡献者的付出
  • 特别感谢 pandas 和 numpy 团队

About

A sample python project to upload to PyPi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published