Metadata-Version: 2.5
Name: etls
Version: 0.0.2
Summary: 表格行列转换：真正的转置，以及「行 / 字典列表」互转。
Project-URL: Homepage, https://pypi.org/project/etls/
Author-email: lqxnjk <lqxnjk@qq.com>
License: MIT
License-File: LICENSE
Keywords: dicts,reshape,rows,table,transpose
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# etls

[English](#english) | 中文

表格行列转换：真正的转置，以及「行 / 字典列表」互转。

## 安装

```console
pip install etls
```

## 用法

```python
from etls import dicts_to_rows, rows_to_dicts, transpose

transpose([["a", "b"], ["x", 1], ["y", 2]])
# [['a', 'x', 'y'], ['b', 1, 2]]

rows_to_dicts(["a", "b"], [[1, 2]])            # [{'a': 1, 'b': 2}]
dicts_to_rows(["a", "b"], [{"b": 2, "a": 1}])  # [[1, 2]]
```

## 说明

`transpose` 做真正的行列互换，输入必须是矩形，行宽不一致抛 `ValueError`。`rows_to_dicts` 与 `dicts_to_rows` 互为逆操作，字段顺序按 `m_headers` 固定，不依赖 dict 的插入顺序；缺键抛 `KeyError`。

## 许可证

MIT

---

<a id="english"></a>
## English

Reshape tables: a true transpose, plus conversion between rows and dicts.

## Install

```console
pip install etls
```

## Usage

```python
from etls import dicts_to_rows, rows_to_dicts, transpose

transpose([["a", "b"], ["x", 1], ["y", 2]])
# [['a', 'x', 'y'], ['b', 1, 2]]

rows_to_dicts(["a", "b"], [[1, 2]])            # [{'a': 1, 'b': 2}]
dicts_to_rows(["a", "b"], [{"b": 2, "a": 1}])  # [[1, 2]]
```

## Notes

`transpose` swaps rows and columns for real; the grid must be rectangular or `ValueError` is raised. `rows_to_dicts` and `dicts_to_rows` are inverses, with column order following `m_headers` rather than dict insertion order; a missing key raises `KeyError`.

## License

MIT
