dcbfeceae637c576a1494e230375dbd682954e3d,batchflow/components.py,ComponentsDict,crop,#ComponentsDict#Any#,146
Before Change
Crops from data in accordance with indices
if self.data is not None and self.indices is not None:
new_data = {}
components = self.components or list(self.data.keys())
for comp in components:
data = self.data.get(comp, None)
data = self._get_from(data, copy)
new_data[comp] = data
After Change
def crop(self, indices=None):
Crops from data in accordance with indices
if isinstance(self.data, pd.DataFrame):
self.data = self.data.loc[indices]
else:
new_data = {}
for comp in self.components:
if isinstance(self.data, BaseComponents):
comp_data = self.data.get(comp, indices)
else:
comp_data = self.data.get(comp)[indices]
new_data[comp] = comp_data
self.data = new_data
@property
def indices(self):
return None if self._crop else self._indices
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances Project Name: analysiscenter/batchflow
Commit Name: dcbfeceae637c576a1494e230375dbd682954e3d
Time: 2019-11-29
Author: rhudor@gmail.com
File Name: batchflow/components.py
Class Name: ComponentsDict
Method Name: crop
Project Name: scikit-optimize/scikit-optimize
Commit Name: 44be9703a0744caf78b8b61319be0db281e91d6a
Time: 2018-04-06
Author: scott_graham@bose.com
File Name: skopt/space/space.py
Class Name: Space
Method Name: from_yaml
Project Name: bokeh/bokeh
Commit Name: 95ab2d1f1cb241580a566644df07b9810e852959
Time: 2015-08-17
Author: nroth@dealnews.com
File Name: bokeh/charts/_data_source.py
Class Name: ChartDataSource
Method Name: get_selections