Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@memoize
def _root(self):
"""
Returns the root node of this Analysis' trace. (It may be itself.)
"""
return self._trace()[0]
@memoize
def dict(self):
"""
Retrieve the contents of this sequence as an
:class:`collections.OrderedDict`.
"""
if self.keys() is None:
raise KeyError
return OrderedDict(self.items())
@memoize
def sum(self):
"""
Compute the values in this column.
Should be invoked via the :class:`.Sum` aggregation.
"""
return sum(self.get_data_without_nulls())
@memoize
def _cache_path(self):
"""
Get the full cache path for the current fingerprint.
"""
return os.path.join(self._cache_dir, '%s.cache' % self._fingerprint())
@memoize
def values_without_nulls(self):
"""
Get the values in this column with any null values removed.
"""
return tuple(d for d in self.values() if d is not None)
@memoize
def _trace(self):
"""
Returns the sequence of Analysis instances that lead to this one.
"""
if self._parent:
return self._parent._trace() + [self]
return [self]
@memoize
def values_distinct(self):
"""
Get the distinct values in this column, as a tuple.
"""
return tuple(set(self.values()))
@memoize
def quartiles(self):
"""
Compute quartiles for this column of data.
:returns: :class:`Quartiles`.
:raises: :exc:`.NullCalculationError`
"""
return Quartiles(self.percentiles())
@memoize
def values(self):
"""
Get the values in this column, as a tuple.
"""
return tuple(row[self._index] for row in self._rows)
@memoize
def values_without_nulls_sorted(self):
"""
Get the values in this column with any null values removed and sorted.
"""
return sorted(self.values_without_nulls(), key=null_handler)