Skip to main content

Given a list of data frames, finds common columns between all pairs of data frames.

Project description

Common Columns Package

This package contains a function called common_columns that can be used to find the common columns between all pairs of data frames.

Installation

To install this package, you can use pip. Open your terminal and run the command provided above.

Usage

To use the common_columns function, you first need to import it from the package:

from common_columns import common_columns
The function takes in a variable-length argument list of pandas data frames. Here's an example of how to use it:

import pandas as pd
from common_columns import common_columns

df1 = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
df2 = pd.DataFrame({'B': [7, 8, 9], 'C': [10, 11, 12]})
df3 = pd.DataFrame({'B': [13, 14, 15], 'D': [16, 17, 18]})

common_cols_all = common_columns(df1, df2, df3)

In this example, we have three data frames (df1, df2, and df3). We call the common_columns function with these data frames as arguments, and store the result in the common_cols_all variable. The common_cols_all variable will contain a set of column names that are common to all three data frames, if any.

Function Description

The common_columns function takes in a variable-length argument list of pandas data frames, and returns a set containing the names of columns that are common to all data frames, if any. It works as follows:

Initialize a list of common columns.

Get the names of the data frames, assigning a default name to any data frames without a name attribute.

Loop over all pairs of data frames.

Find the common columns between the two data frames. If there are common columns, add them to the list of common columns.

Find the common columns across all data frames.

Return a set containing the names of columns that are common to all data frames, if any.

Contributing

If you'd like to contribute to this package, please feel free to fork the repository and submit a pull request. We welcome contributions from the community! You can also contact me on my personal email adress: elenagarciamanes@gmail.com

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

common-cols-project-0.1.3.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

common_cols_project-0.1.3-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file common-cols-project-0.1.3.tar.gz.

File metadata

  • Download URL: common-cols-project-0.1.3.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for common-cols-project-0.1.3.tar.gz
Algorithm Hash digest
SHA256 bf07473e855a380bd531128f5e21902cc7fe22773694b4050d9df924e08c4c16
MD5 29f3ac4526420a19fcda7683ec57f41c
BLAKE2b-256 46cc77af808574dc8d34862ebf0305436d99caee9d259db654d676623f4d2c46

See more details on using hashes here.

File details

Details for the file common_cols_project-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for common_cols_project-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e2970ec26976761fdcab20b6fa10a69676500224c7ba6e517be50120d1c9c7cd
MD5 3b0f1aeb536272850d48b89d284c0cfc
BLAKE2b-256 4a67afab7b814db737a3c0df0d3eaf7845b5062e3e2ebe93afd816a1a34cf28a

See more details on using hashes here.

Supported by

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