Code Monkey home page Code Monkey logo

dfcompare's Introduction

DFCompare

version 0.1

  • A package to compare two pandas DataFrames.

Prerequisites

System requirement:

Required packages:

Installation

Method 1:

  1. Run the follow command.
pip install git+https://github.com/kitman0804/.git

Method 2:

  1. Download the repository.

  2. Run the following command in the downloaded directory.

python setup.py install

Examples

from io import StringIO
import pandas as pd
from DFCompare import DFCompare

a = """Name,Value
Felix,123
Joyce,231213
Leo,1332
Perry,1999
Tat,
"""

b = """Name,Value
Felix,1234
Joyce,231213
Leo2,1332
Tat,
"""

df_a = pd.read_csv(StringIO(a), sep=',')
df_b = pd.read_csv(StringIO(b), sep=',')

compare_a = DFCompare(df_a)

# No. of rows
compare_a.compare_rows(df_b)
# Output:
# base    5
# data    4
# dtype: int64

# No. of columns
compare_a.compare_cols(df_b)
# Output:
# base      2
# data      2
# common    2
# dtype: int64

# Data types
compare_a.compare_dtypes(df_b)
# Output:
#   Column    dtype
#              base     data match
# 0   Name   object   object  True
# 1  Value  float64  float64  True

# Base data that is not in the data to be compared
compare_a.rows_not_in(df_b)
# Output:
#     Name   Value
# 0  Felix   123.0
# 2    Leo  1332.0
# 3  Perry  1999.0

dfcompare's People

Contributors

pe-perry avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.