Skip to main content

A small example package

Project description

compare_df

介绍

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

安装

pip install compare_dfs

使用

import pandas as pd
import compare_dfs as cpdfs

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_colnames = cpdfs.compare_colnames(df1, df2)
print(different_colnames)

print(cpdfs.compare(df1, df2, different_colnames, dfname_1="左表", dfname_2="右表"))

输出:

只在第一个表中的列名:{'age1'}
只在第二个表中的列名:{'age2'}
[('age1', 'age2')]
左表中有,右表中没有的索引:{5}
右表中有,左表中没有的索引:{6}
=====================================
   name_左表 name_右表
id                
3        c       f
=====================================
    age1  age2
id            
2     20    25
=====================================
[   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.6.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: compare_dfs-0.0.6.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.6.tar.gz
Algorithm Hash digest
SHA256 9fa7f44fd2ff196622e0b29f3009c617a44471ce01b60bf86d3c5c8eba6b7a29
MD5 0ae2dffe3169e5062655b344c33edbe4
BLAKE2b-256 c218782c031b24d0efe1c39ab006cd96474b4da87c145db9c644fd88e4a0d47c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: compare_dfs-0.0.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5e6f2b4fe8006350adefd2831d95f17426668c153641e2b7bd52fbfef0cee612
MD5 17da9acf0d03d5aaed867942bdf7d4db
BLAKE2b-256 908d3c7ea517384393b7ffc11d1e5c0641893adc9a0b3daa43fe5e8a46e7e6ee

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