sdv/metadata/table.py
def fit(self, data):
        """Fit this metadata to the given data.

        Args:
            data (pandas.DataFrame):
                Table to be analyzed.
        """
        LOGGER.info('Fitting table %s metadata', self.name)
        if not self._field_names:
            self._field_names = list(data.columns)
        elif isinstance(self._field_names, set):
            self._field_names = [field for field in data.columns if field in self._field_names]

        self._dtypes = data[self._field_names].dtypes

        if not self._fields_metadata:
            self._fields_metadata = self._build_fields_metadata(data)

        # Re-set the primary key to validate its name and type
        self.set_primary_key(self._primary_key)

        self._make_anonymization_mappings(data)
        LOGGER.info('Anonymizing table %s', self.name)
        data = self._anonymize(data)

        LOGGER.info('Fitting constraints for table %s', self.name)
        constrained = self._fit_transform_constraints(data)
        extra_columns = set(constrained.columns) - set(data.columns)

        LOGGER.info('Fitting HyperTransformer for table %s', self.name)
        self._fit_hyper_transformer(constrained, extra_columns)
        self.fitted = True
Fit this metadata to the given data.

        Args:
            data (pandas.DataFrame):
                Table to be analyzed.
        
Fit this metadata to the given data.
Fit this metadata to the given data .
def fit(self, data):
        LOGGER.info('Fitting table %s metadata', self.name)
        if not self._field_names:
            self._field_names = list(data.columns)
        elif isinstance(self._field_names, set):
            self._field_names = [field for field in data.columns if field in self._field_names]
        self._dtypes = data[self._field_names].dtypes
        if not self._fields_metadata:
            self._fields_metadata = self._build_fields_metadata(data)
        self.set_primary_key(self._primary_key)
        self._make_anonymization_mappings(data)
        LOGGER.info('Anonymizing table %s', self.name)
        data = self._anonymize(data)
        LOGGER.info('Fitting constraints for table %s', self.name)
        constrained = self._fit_transform_constraints(data)
        extra_columns = set(constrained.columns) - set(data.columns)
        LOGGER.info('Fitting HyperTransformer for table %s', self.name)
        self._fit_hyper_transformer(constrained, extra_columns)
        self.fitted = True
def fit ( self , data ) : LOGGER . info ( 'Fitting table %s metadata' , self . name ) if not self . _field_names : self . _field_names = list ( data . columns ) elif isinstance ( self . _field_names , set ) : self . _field_names = [ field for field in data . columns if field in self . _field_names ] self . _dtypes = data [ self . _field_names ] . dtypes if not self . _fields_metadata : self . _fields_metadata = self . _build_fields_metadata ( data ) self . set_primary_key ( self . _primary_key ) self . _make_anonymization_mappings ( data ) LOGGER . info ( 'Anonymizing table %s' , self . name ) data = self . _anonymize ( data ) LOGGER . info ( 'Fitting constraints for table %s' , self . name ) constrained = self . _fit_transform_constraints ( data ) extra_columns = set ( constrained . columns ) - set ( data . columns ) LOGGER . info ( 'Fitting HyperTransformer for table %s' , self . name ) self . _fit_hyper_transformer ( constrained , extra_columns ) self . fitted = True
Fit this metadata to the given data.
Fit this metadata to the given data .
"""Fit this metadata to the given data.

        Args:
            data (pandas.DataFrame):
                Table to be analyzed.
        """ # Re-set the primary key to validate its name and type
self
data
Table to be analyzed.
Table to be analyzed .