Skip to main content

etls

English | 中文

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

安装

pip install etls

用法

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


English

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

Install

pip install etls

Usage

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

Metadata

Release files for etls 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for etls 0.0.2
File Size Uploaded Provenance
etls-0.0.2.tar.gz 3.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for etls 0.0.2
File Interpreter ABI Platform
etls-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 6.9 kB

Release files / etls-0.0.2.tar.gz

Download URL etls-0.0.2.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8680e0eea9edab21f148d14e67555a05d2bb3a4f02ba6e47b7463ad905761568
BLAKE2b-256 checksum
How to use checksums
6711013fdd1797d07b17e88ff917f3e3eb9de45e1efe43a9ebcb2b77acd6e121
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Release files / etls-0.0.2-py3-none-any.whl

Download URL etls-0.0.2-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1c4c2d4ad2fb11b8eabdb1d50b6cc2715a32af355e2c356da1d7b46c3c320d8
BLAKE2b-256 checksum
How to use checksums
242a93d2b20668f058d938b090491990d215b8e5350c5cb135c6fa5da84ee358
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Security for etls 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page