Skip to main content

This Library converts categorical data of any kind {integer, float, strings} into discrete values{1,2,3... # Classes}.

Project description

This package can be used to convert dataset into numerical categorical data. This can be utilized for the pre-processing of various kinds of data for many Machine Learning Models. There are various features available such as normalizing the data to make the data more useful for the model. This function will work on any kind of data in the DataFrame.

IMPORT:

from categorical_encode.categorical import categorical

The Parameters:-

  • dataframe: The Input DataFrame(X) which you want to categorically encode.

  • normalize: This parameter determines if it will be between 0-1(1 included) or 1 to no. of classes (1 - no. of classes). default:False

  • drop_columns: This specifies the dataframe columns that need to be dropped as they are useless. default: No Columns

  • drop_na: This drops empty values (NaN) if is set to True. default: False

  • target_columns: This creates the target DataFrame(Y) without applying any Encoding. default: No Columns

Return

This Returns Two DataFrame (X,Y) if target_columns are provided Else only the Input dataframe (X) which is encoded.

Example:

from categorical_encode.categorical import categorical

df = categorical(dataframe = df, normalize= True)

This returns df as categorically encoded column-wise for all the columns having values between 0-1(1 included).

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

categorical_encode-0.2.1.tar.gz (2.4 kB view hashes)

Uploaded Source

Supported by

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