Skip to content

A python script using for converting list and sets of boolean categorical data into one-hot format and back again.

Notifications You must be signed in to change notification settings

jlcarr/Onehotify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Onehotify

A Python script for converting categorical data into one-hot encoding

Features

  • Uses only standard Python libraries
  • Takes input as either set or list format
  • Uses only standard Python libraries
  • Comes with a main contaning an illustrative example
  • All functions have docstrings
  • Simple design and usage.

Installation

Requires Python 2.7 Simply add the file to the same directory you are working in and import it

>>> import onehotify

Usage

Premade Example

Running the script by itself in the terminal will output the following example

$ python onehotify.py
The categories are: set(['orange', 'apple', 'banana'])

The encoding is
	0 maps to orange
	1 maps to apple
	2 maps to banana

The set ['apple', 'orange'] is encoded as
[1, 1, 0]
From which the original can be recovered by decoding
set(['orange', 'apple'])

About

A python script using for converting list and sets of boolean categorical data into one-hot format and back again.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages