/PyXplor

A package for simplifying the EDA of different data types!

Primary LanguagePythonMIT LicenseMIT

pyxplor

Documentation Status License: MIT ci-cd Project Status: Active – The project has reached a stable, usable state and is being actively developed. codecov

version release Python 3.12.0 PyPI - Version

A package for simplifying the EDA of different data types!

About

pyxplor is a comprehensive Python package designed to automate and streamline the Exploratory Data Analysis (EDA) process. Tailored for various data types including numeric, categorical, binary, and time series data, pyxplor aims to enhance data interpretation through a suite of specialized plotting functions. This package seeks to reduce the complexity and time invested in initial data analysis, making it an essential tool for data scientists and analysts at all levels.

Documentation

The online documentation can be accessed here.

Installation

User Installation

Run the following code in your terminal to install the package from PyPI:

pip install pyxplor

Developer Installation

  1. Clone the repository.
git clone https://github.com/UBC-MDS/PyXplor.git
cd pyxplor
  1. Create an environment with conda and then activate the environment.
conda create -n pyxplor python=3.12 -y
conda activate pyxplor
  1. Install poetry inside the environment.
conda install poetry
  1. Run poetry install.
poetry install

Testing

To test that the functions are working properly, run the commands below from the root directory.

pytest tests/

To see the coverage of the tests, run the commands below instead.

pytest tests/ --cov=pyxplor

Usage

The functions in pyxplor are very simple to use. Below is a simple demonstration:

from pyxplor.plot_binary import plot_binary
from pyxplor.plot_categorical import plot_categorical
from pyxplor.plot_numeric import plot_numeric
from pyxplor.plot_time_series import plot_time_series
import seaborn as sns
import pandas as pd

# a dataframe that contains different types of variables
taxi = sns.load_dataset("taxis")
taxi = taxi.dropna()

# different variable types
binary_variables = ['color', 'payment']
categorical_variables = ['passengers', 'pickup_zone']
numeric_variables = ['fare', 'tip']
datetime_variable = 'pickup'

# univariate plotting each of the variable type
fig, ax = plot_binary(taxi, binary_variables, "count")
fig, ax = plot_categorical(taxi, categorical_variables)
fig, ax = plot_numeric(taxi, numeric_variables, "hist+kde")
fig, ax = plot_time_series(taxi, datetime_variable, numeric_variables, freq='M')

Functions

  • plot_numeric(input_df, list_of_variables, ...): Plots the distribution of numeric variables in a DataFrame, offering options for histograms, KDE plots, or a combination of both.
  • plot_categorical(input_df, list_of_variables, ...): Visualizes categorical data by creating bar plots for each categorical variable specified, aiding in understanding frequency distributions.
  • plot_binary(input_df, list_of_variables, ...): Generates plots for binary variables, either as bar plots or pie charts, to highlight distributions and potential imbalances.
  • plot_time_series(input_df, date_column, value_columns, ...): Specialized in time-series analysis, this function creates line plots for multiple time series variables, allowing for trend analysis and comparison.

PyXplor Use in Python Ecosystem

While there are several EDA packages in the Python ecosystem, such as pandas-profiling (link) and sweetviz (link), pyxplor differentiates itself by offering specialized functions for different data types. This targeted approach enables more nuanced and relevant insights, particularly for binary and time-series data which are often less catered for in existing tools. pyxplor complements these existing tools by filling these specific gaps, thus enriching the Python EDA toolkit.

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

Contributors

  • Po-Hsun (Ben) Chen (@phchen5)
  • Rachel Bouwer (@rbouwer)
  • Arturo Boquin (@arturoboquin)
  • Iris Luo (@luonianyi)

License

pyxplor was created by Ben Chen, Rachel Bouwer, Arturo Boquin, and Iris Luo. It is licensed under the terms of the MIT license.

Credits

pyxplor was created with cookiecutter and the py-pkgs-cookiecutter template.