Change the dataset identifiers based on the names in the dictionary.
160934
def change_identifiers(datadf, split_dict):
    """"""
    for rid, name in split_dict.items():
        datadf.loc[datadf["runIDs"] == rid, "dataset"] = name
834550
def _parse_names_set(feature_names):
        """"""
        feature_collection = OrderedDict()
        for feature_name in feature_names:
            if isinstance(feature_name, str):
                feature_collection[feature_name] = ...
            else:
                raise ValueError('Failed to parse {}, expected string'.format(feature_name))
        return feature_collection
858765
def _read_datasets(self, dataset_nodes, **kwargs):
        """"""
        # Sort requested datasets by reader
        reader_datasets = {}

        for node in dataset_nodes:
            ds_id = node.name
            # if we already have this node loaded or the node was assigned
            # by the user (node data is None) then don't try to load from a
            # reader
            if ds_id in self.datasets or not isinstance(node.data, dict):
                continue
            reader_name = node.data.get('reader_name')
            if reader_name is None:
                # This shouldn't be possible
                raise RuntimeError("Dependency tree has a corrupt node.")
            reader_datasets.setdefault(reader_name, set()).add(ds_id)

        # load all datasets for one reader at a time
        loaded_datasets = DatasetDict()
        for reader_name, ds_ids in reader_datasets.items():
            reader_instance = self.readers[reader_name]
            new_datasets = reader_instance.load(ds_ids, **kwargs)
            loaded_datasets.update(new_datasets)
        self.datasets.update(loaded_datasets)
        return loaded_datasets
1356182
def redim(cls, dataset, dimensions):
        
        new_dataset = dataset.data.copy()
        for name, new_dim in dimensions.items():
            if name == new_dataset.name():
                new_dataset.rename(new_dim.name)
            for coord in new_dataset.dim_coords:
                if name == coord.name():
                    coord.rename(new_dim.name)
        return new_dataset
893619
def try_fix_dataset(dataset):
    """"""
    if isinstance(dataset, numpy.ndarray):
        if len(dataset.shape) == 3:  # NumPy 3D
            if dataset.shape[-1] == 3:
                return dataset.transpose((2, 0, 1))
        elif len(dataset.shape) == 4:  # NumPy 4D
            if dataset.shape[-1] == 3:
                return dataset.transpose((0, 3, 1, 2))
        # Otherwise couldn't fix it.
        return dataset
    # List of Numpy 3D arrays.
    for i, d in enumerate(dataset):
        if not isinstance(d, numpy.ndarray):
            return dataset
        if not (len(d.shape) == 3 and d.shape[-1] == 3):
            return dataset
        dataset[i] = d.transpose()
    return dataset
830725
def replace_aliases(cut_dict, aliases):
    """"""
    for k, v in cut_dict.items():
        for k0, v0 in aliases.items():
            cut_dict[k] = cut_dict[k].replace(k0, '(%s)' % v0)
1090834
def changeset(python_data: LdapObject, d: dict) -> Changeset:
    
    table: LdapObjectClass = type(python_data)
    fields = table.get_fields()
    changes = Changeset(fields, src=python_data, d=d)
    return changes
968292
private IDataSet performReplacements(IDataSet dataSet, List<Replacer> replacersList) {

        if (replacersList == null || replacersList.isEmpty())
            return dataSet;

        ReplacementDataSet replacementSet = new ReplacementDataSet(dataSet);
        // convert to set to remove duplicates
        Set<Replacer> replacers = new HashSet<>((List<Replacer>) replacersList);
        for (Replacer replacer : replacers) {
            replacer.addReplacements(replacementSet);
        }

        return replacementSet;
    }
925892
public void replaceNumericFeatures(List<Vec> newNumericFeatures)
    {
        if(this.size() != newNumericFeatures.size())
            throw new RuntimeException("Input list does not have the same not of dataums as the dataset");
        
        for(int i = 0; i < newNumericFeatures.size(); i++)
        {
            DataPoint dp_i = getDataPoint(i);
            setDataPoint(i, new DataPoint(newNumericFeatures.get(i), dp_i.getCategoricalValues(), dp_i.getCategoricalData()));
        }
        
        this.numNumerVals = getDataPoint(0).numNumericalValues();
        if (this.numericalVariableNames != null)
            this.numericalVariableNames.clear();
            
    }
550999
def update_ds_ids_from_file_handlers(self):
        
        for file_handlers in self.file_handlers.values():
            fh = file_handlers[0]
            # update resolution in the dataset IDs for this files resolution
            res = getattr(fh, 'resolution', None)
            if res is None:
                continue

            for ds_id, ds_info in list(self.ids.items()):
                file_types = ds_info['file_type']
                if not isinstance(file_types, list):
                    file_types = [file_types]
                if fh.filetype_info['file_type'] not in file_types:
                    continue
                if ds_id.resolution is not None:
                    continue
                ds_info['resolution'] = res
                new_id = DatasetID.from_dict(ds_info)
                self.ids[new_id] = ds_info
                del self.ids[ds_id]
1052033
def is_dataset(ds):
  """"""
  import tensorflow as tf
  from tensorflow_datasets.core.utils import py_utils
  dataset_types = [tf.data.Dataset]
  v1_ds = py_utils.rgetattr(tf, "compat.v1.data.Dataset", None)
  v2_ds = py_utils.rgetattr(tf, "compat.v2.data.Dataset", None)
  if v1_ds is not None:
    dataset_types.append(v1_ds)
  if v2_ds is not None:
    dataset_types.append(v2_ds)
  return isinstance(ds, tuple(dataset_types))
158192
def replace_uuid_w_names(self, resp):
        
        
        col_mapper = self.get_point_name(resp.context)["?point"].to_dict()
        resp.df.rename(columns=col_mapper, inplace=True)
        return resp
426529
def _convert_dataset_files(value):
    """"""
    output = {}
    for k, v in value.items():
        inst = DatasetFile.from_jsonld(v)
        output[inst.path] = inst
    return output
1083124
def from_dict(cls, d, **kwargs):
        """"""
        args = []
        for k in DATASET_KEYS:
            val = kwargs.get(k, d.get(k))
            # force modifiers to tuple
            if k == 'modifiers' and val is not None:
                val = tuple(val)
            args.append(val)

        return cls(*args)
938895
def add_ds_ids_from_files(self):
        """"""
        for file_handlers in self.file_handlers.values():
            try:
                fh = file_handlers[0]
                avail_ids = fh.available_datasets()
            except NotImplementedError:
                continue

            # dynamically discover other available datasets
            for ds_id, ds_info in avail_ids:
                # don't overwrite an existing dataset
                # especially from the yaml config
                coordinates = ds_info.get('coordinates')
                if isinstance(coordinates, list):
                    # xarray doesn't like concatenating attributes that are
                    # lists: https://github.com/pydata/xarray/issues/2060
                    ds_info['coordinates'] = tuple(ds_info['coordinates'])
                self.ids.setdefault(ds_id, ds_info)
1158965
def _get_coordinates_for_dataset_keys(self, dsids):
        """"""
        coordinates = {}
        for dsid in dsids:
            cids = self._get_coordinates_for_dataset_key(dsid)
            coordinates.setdefault(dsid, []).extend(cids)
        return coordinates
192285
def addDataset(self, dataset):
        
        self._datasets.append(dataset)
        self._dataChanged = True
        self._addDatasetAction(dataset)