MCPcopy Create free account
hub / github.com/dask/dask / _simplify_up

Method _simplify_up

dask/dataframe/dask_expr/_expr.py:2032–2057  ·  view source on GitHub ↗
(self, parent, dependents)

Source from the content-addressed store, hash-verified

2030 return bool(set(input_columns) & set(child.keys))
2031
2032 def _simplify_up(self, parent, dependents):
2033 if isinstance(parent, Projection):
2034 columns = determine_column_projection(self, parent, dependents)
2035 columns = _convert_to_list(columns)
2036
2037 cols = set(columns) - set(self.keys)
2038 if cols == set(self.frame.columns):
2039 # Protect against pushing the same projection twice
2040 return
2041
2042 diff = set(self.keys) - set(columns)
2043 if len(diff) == len(self.keys):
2044 return type(parent)(self.frame, *parent.operands[1:])
2045 elif len(diff) > 0:
2046 new_args = []
2047 for k, v in zip(self.keys, self.vals):
2048 if k in columns:
2049 new_args.extend([k, v])
2050 else:
2051 new_args = self.operands[1:]
2052
2053 columns = [col for col in self.frame.columns if col in cols]
2054 return type(parent)(
2055 type(self)(self.frame[sorted(columns)], *new_args),
2056 *parent.operands[1:],
2057 )
2058
2059
2060class Eval(Elemwise):

Callers

nothing calls this directly

Calls 3

_convert_to_listFunction · 0.90
setClass · 0.85

Tested by

no test coverage detected