258bb52cbbf7ebcf0d0e6d2779dd9a86ea323e7f,janitor/functions.py,,encode_categorical,#Any#Any#,334
Before Change
if isinstance(column_names, list) or isinstance(column_names, tuple):
for col in column_names:
assert col in df.columns, JanitorError(
"{col} missing from dataframe columns!".format(col=col)
)
df[col] = pd.Categorical(df[col])
elif isinstance(column_names, str):
assert column_names in df.columns, JanitorError(
"{column_names} missing from dataframe columns!".format(
After Change
if isinstance(column_names, list) or isinstance(column_names, tuple):
for col in column_names:
if col not in df.columns:
raise JanitorError(f"{col} missing from dataframe columns!")
df[col] = pd.Categorical(df[col])
elif isinstance(column_names, str):
if column_names not in df.columns:
raise JanitorError(
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: ericmjl/pyjanitor
Commit Name: 258bb52cbbf7ebcf0d0e6d2779dd9a86ea323e7f
Time: 2019-09-02
Author: 23343812+hectormz@users.noreply.github.com
File Name: janitor/functions.py
Class Name:
Method Name: encode_categorical
Project Name: ericmjl/pyjanitor
Commit Name: 258bb52cbbf7ebcf0d0e6d2779dd9a86ea323e7f
Time: 2019-09-02
Author: 23343812+hectormz@users.noreply.github.com
File Name: janitor/functions.py
Class Name:
Method Name: fill_empty
Project Name: ericmjl/pyjanitor
Commit Name: 258bb52cbbf7ebcf0d0e6d2779dd9a86ea323e7f
Time: 2019-09-02
Author: 23343812+hectormz@users.noreply.github.com
File Name: janitor/functions.py
Class Name:
Method Name: label_encode