Skip to main content

A small example package

Project description

compare_df

介绍

找出两个几乎相同的DataFrame的差异

安装

pip install compare_dfs

使用

import pandas as pd
import compare_dfs.compare as compare

df1 = pd.DataFrame({
    "id": [1, 2, 3, 4, 5],
    "name": ["a", "b", "c", "d", "e"],
    "age1": [10, 20, 30, 40, 50],
})
df2 = pd.DataFrame({
    "id": [1, 2, 3, 4, 6],
    "name": ["a", "b", "f", "d", "e"],
    "age2": [10, 25, 30, 40, 50],
})

df1.set_index("id", inplace=True)
df2.set_index("id", inplace=True)

# 检查所有列名一致的列,其余请填入different_col_names
compare(df1, df2, different_col_names=[("age1", "age2")], dfname_1="左表", dfname_2="右表")

输出:

左表中有,右表中没有的索引:{5}
右表中有,左表中没有的索引:{6}
=====================================
   name_左表 name_右表
id                
3        c       f
=====================================
    age1  age2
id            
2     20    25
=====================================

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

compare_dfs-0.0.4.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

compare_dfs-0.0.4-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file compare_dfs-0.0.4.tar.gz.

File metadata

  • Download URL: compare_dfs-0.0.4.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for compare_dfs-0.0.4.tar.gz
Algorithm Hash digest
SHA256 87a5d7aa57eb1ab09e8350fe4efcaffea6bc91ea24f8a85a668b3856e5fe1fe1
MD5 e1a19320c8d2c7c69c76071342858030
BLAKE2b-256 247329398f91a4a49dd3e97c5c5f6b74ad1f84cfa73187a9b509489d828b6a27

See more details on using hashes here.

File details

Details for the file compare_dfs-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: compare_dfs-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for compare_dfs-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2e737d1fa8e96ea1c122c76dda995b3ae8f119dc11af03dd317392598d686fc8
MD5 8df31c8d1d78c4461fb665b478e6bdaa
BLAKE2b-256 76fddf0fbff333a2c4b957d48dafb4f664ebbe10d2dbc579a9fd5ef38191e627

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page