Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Python package df2onehot is to convert a pandas dataframe into a stuctured dataframe.

Project description


Python PyPI Version License Downloads Downloads Coffee

Star it if you like it!
  • df2onehot is Python package to convert your complex dataframe into a one-hot dense array.



  • Install df2onehot from PyPI (recommended). df2onehot is compatible with Python 3.6+ and runs on Linux, MacOS X and Windows.
  • It is distributed under the MIT license.

Quick Start

pip install df2onehot
  • Alternatively, install df2onehot from the GitHub source:
git clone
cd df2onehot
python -U install

Import df2onehot package

import df2onehot
# Example dataset
df = df2onehot.import_example()


from df2onehot import df2onehot
# Convert
out = df2onehot(df)
# Force features (int or float) to be numeric if unique non-zero values are above percentage.
out = df2onehot(df, perc_min_num=0.8)
# Remove categorical features for which less then 2 values exists.
out = df2onehot(df, y_min=2)
# Combine two rules above.
out = df2onehot(df, y_min=2, perc_min_num=0.8)


  • Erdogan Taskesen, github: erdogant
  • Contributions are welcome.
  • If you wish to buy me a Coffee for this work, it is very appreciated :)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for df2onehot, version 0.2.16
Filename, size File type Python version Upload date Hashes
Filename, size df2onehot-0.2.16-py3-none-any.whl (13.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size df2onehot-0.2.16.tar.gz (11.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page