Is there a way to get a list of all my categorical and numerical features in Pycaret?

496 views Asked by At

I am using Pycaret for a classification problem and I want to get a list of all the categorical and numerical variables inferred by setup() for EDA. Is there a way to do this?

I have tried looking at any function in the documentation but couldn't find anything.

1

There are 1 answers

6
Tatchai S. On

Currently, I find only one way to do it in PyCaret 3.x by accessing the private variable of the Experiment object.

from pycaret.datasets import get_data
from pycaret.classification import *

data = get_data('bank', verbose=False)
exp = setup(data = data, target = 'deposit', session_id=123, verbose=False);

print(f'Ordinal features: {exp._fxs["Ordinal"]}')
print(f'Numeric features: {exp._fxs["Numeric"]}')
print(f'Date features: {exp._fxs["Date"]}')
print(f'Text features: {exp._fxs["Text"]}')
print(f'Categorical features: {exp._fxs["Categorical"]}')

enter image description here