Skip to main content

pdcleaner

Description

用于清洗pandas数据表格

安装

# 安装
pip install pdcleaner

# 升级
pip install --upgrade pdcleaner

# 卸载
pip uninstall pdcleaner

使用示例

import pandas as pd
from pdcleaner import DataSet

def test_clean_data():
    # 生成测试数据
    test_data = {
        'Column 1': [' 1,234 ', '-1,253.8', "增长369,666.0", "1,2,3", None, '-'],
        'Column 2': ['20%', '98.88%', "1,235.69%", "增长10%", '-10%', '50%'],
        'Column 3': ['  extra space  ', 'no change', "'single'", "multi\nline\rtext", '1,234.56', '25%'],
        '数据写入时间2': ['2023-10-01 12:34:56', '2023-10-02 13:45:56', '2023-10-03 14:56:57', '2023-10-04 15:07:58', '2023-10-05 16:18:59', '2023-10-06 17:29:60']
    }
    df = pd.DataFrame(test_data)

    # 调用 clean_data 函数
    cleaned_df = DataSet.clean_data(df, drop_cols=['数据写入时间2'], rename_cols={'Column 1': 'New Column 1'}, add_time=True)
    print(cleaned_df)

if __name__ == '__main__':
    test_clean_data()

参数说明

参数:
df (pd.DataFrame): 输入的数据框。
drop_cols (list, optional): 需要删除的列名列表。默认为 None。
rename_cols (dict, optional): 需要重命名的列名字典,键为旧列名,值为新列名。默认为 None。
add_time (bool, optional): 是否添加数据写入时间列。默认为 False。

返回:
pd.DataFrame: 清洗后的数据框。

Metadata

Release files for pdcleaner 1.0.12

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

Source distribution (sdist)

Source distribution for pdcleaner 1.0.12
File Size Uploaded Provenance Actions
pdcleaner-1.0.12.tar.gz 4.1 kB Without provenance Details for pdcleaner-1.0.12.tar.gz

Built distribution (wheel)

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

Total release size: 8.4 kB

Release files / pdcleaner-1.0.12.tar.gz

Download URL pdcleaner-1.0.12.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8157f829da3663e4f5faa1f05186adc69a37c69cc0c081cae4f8ce8281013efe
BLAKE2b-256 checksum
How to use checksums
c65fddd729e5114e0b38e1c9ae01d9fbeb316ba2ccd898ccc096d8f98b38abd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pdcleaner-1.0.12-py3-none-any.whl

Download URL pdcleaner-1.0.12-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f2bb0628145897e943ef655f9c0ef9b140856f491aab21ac7d68ac29ac7f982a
BLAKE2b-256 checksum
How to use checksums
a975060681f1a4f1c5f04562d0b4731d718564ddb310ce17853faaabda29dc03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pdcleaner 1.0.12

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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