Source code for ads.type_discovery.unknown_detector
#!/usr/bin/env python# -*- coding: utf-8; -*-# Copyright (c) 2020, 2022 Oracle and/or its affiliates.# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/from__future__importprint_function,absolute_import,divisionimportpandasaspdfromads.type_discoveryimportloggerfromads.type_discovery.abstract_detectorimportAbstractTypeDiscoveryDetectorfromads.type_discovery.typed_featureimport(UnknownTypedFeature,CategoricalTypedFeature,)
[docs]defdiscover(self,name,series):candidate=series.loc[~series.isnull()].iloc[0]ifseries.dtype=="object":## if we got all through all the other detectors and it's a string type of feature then we# just call it a high dimensional categorical#returnCategoricalTypedFeature.build(name,series)else:logger.debug("type discovery on column [{}]/[{}] result is Unknown".format(name,series.dtype))returnUnknownTypedFeature.build(name,series)