11#!/usr/bin/env python
2- # -*- coding: utf-8 -*--
32
4- # Copyright (c) 2021, 2022 Oracle and/or its affiliates.
3+ # Copyright (c) 2021, 2025 Oracle and/or its affiliates.
54# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
65
76"""
1110 Category
1211 The Category feature type.
1312"""
13+
1414import matplotlib .pyplot as plt
1515import pandas as pd
16+
17+ from ads .common .decorator .runtime_dependency import (
18+ OptionalDependency ,
19+ runtime_dependency ,
20+ )
21+ from ads .feature_engineering import schema
1622from ads .feature_engineering .feature_type .base import FeatureType
1723from ads .feature_engineering .utils import (
24+ SchemeTeal ,
1825 _count_unique_missing ,
1926 _set_seaborn_theme ,
20- SchemeTeal ,
21- )
22- from ads .feature_engineering import schema
23- from ads .common .decorator .runtime_dependency import (
24- runtime_dependency ,
25- OptionalDependency ,
2627)
2728
2829
@@ -71,7 +72,7 @@ def feature_stat(x: pd.Series) -> pd.DataFrame:
7172 Examples
7273 --------
7374 >>> cat = pd.Series(['S', 'C', 'S', 'S', 'S', 'Q', 'S', 'S', 'S', 'C', 'S', 'S', 'S',
74- 'S', 'S', 'S', 'Q', 'S', 'S', '', np.NaN , None], name='сategory')
75+ 'S', 'S', 'S', 'Q', 'S', 'S', '', np.nan , None], name='сategory')
7576 >>> cat.ads.feature_type = ['сategory']
7677 >>> cat.ads.feature_stat()
7778 Metric Value
@@ -100,7 +101,7 @@ def feature_plot(x: pd.Series) -> plt.Axes:
100101 Examples
101102 --------
102103 >>> cat = pd.Series(['S', 'C', 'S', 'S', 'S', 'Q', 'S', 'S', 'S', 'C', 'S', 'S', 'S',
103- 'S', 'S', 'S', 'Q', 'S', 'S', '', np.NaN , None], name='сategory')
104+ 'S', 'S', 'S', 'Q', 'S', 'S', '', np.nan , None], name='сategory')
104105 >>> cat.ads.feature_type = ['сategory']
105106 >>> cat.ads.feature_plot()
106107 """
@@ -121,7 +122,7 @@ def feature_domain(cls, x: pd.Series) -> schema.Domain:
121122 Examples
122123 --------
123124 >>> cat = pd.Series(['S', 'C', 'S', 'S', 'S', 'Q', 'S', 'S', 'S', 'C', 'S', 'S', 'S',
124- 'S', 'S', 'S', 'Q', 'S', 'S', '', np.NaN , None], name='category')
125+ 'S', 'S', 'S', 'Q', 'S', 'S', '', np.nan , None], name='category')
125126 >>> cat.ads.feature_type = ['category']
126127 >>> cat.ads.feature_domain()
127128 constraints:
0 commit comments