Skip to main content

A small example package

Project description

compare_df

介绍

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

安装

pip install compare_dfs

使用

import pandas as pd
from compare_dfs import 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.5.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: compare_dfs-0.0.5.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.5.tar.gz
Algorithm Hash digest
SHA256 bfa65f5fbfa6dd6f0eef9ae9c5eab5ea7c8f903d0902d5b664822ed879487ab4
MD5 3228286f4084862d66b19523b997cfb9
BLAKE2b-256 234db257eb4f25b714f8837113e25547b89409dc7fb7d8f43518828f1bdc145c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: compare_dfs-0.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 dacaf5258f49bcb1f7a53188dc1b1a9f6aab5fa043dfe80df6c82493163d84ae
MD5 1f9a54a1098c68c917c97c6f759c9add
BLAKE2b-256 baac164a93d07c76363a2c5059108927cf5b2a715b4125f1d252b1443e14dbef

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