Skip to content

Commit

Permalink
Merge pull request #349 from boazmohar/base_docs
Browse files Browse the repository at this point in the history
Doc changes to Base and Data classes
  • Loading branch information
freeman-lab committed Jul 30, 2016
2 parents ef2633a + 0d0f40c commit 0fbdf89
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions thunder/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def cache(self):

def uncache(self):
"""
Enable in-memory caching.
Disable in-memory caching (Spark only).
"""
if self.mode == 'spark':
self.values.unpersist()
Expand All @@ -149,7 +149,7 @@ def uncache(self):

def iscached(self):
"""
Get whether object is cached.
Get whether object is cached (Spark only).
"""
if self.mode == 'spark':
return self.tordd().iscached
Expand All @@ -158,7 +158,7 @@ def iscached(self):

def npartitions(self):
"""
Get number of partitions.
Get number of partitions (Spark only).
"""
if self.mode == 'spark':
return self.tordd().getNumPartitions()
Expand Down Expand Up @@ -254,6 +254,18 @@ def labels(self, value):
def astype(self, dtype, casting='unsafe'):
"""
Cast values to the specified type.
Parameters
----------
dtype : str or dtype
Typecode or data-type to which the array is cast.
casting : ['no', 'equiv', 'safe', 'same_kind', 'unsafe'], optional
Controld what kind of data casting may occur. Defaluts to 'unsafe' for backwards compatibility.
'no' means the data types should not be cast at all.
'equiv' means only byte-order changes are allowed.
'safe' means only casts which can preserve values are allowed.
'same_kind' means only safe casts or casts within a kind, like float64 to float32, are allowed.
'unsafe' means any data conversions may be done.
"""
return self._constructor(
self.values.astype(dtype=dtype, casting=casting)).__finalize__(self)
Expand Down Expand Up @@ -376,9 +388,6 @@ def filter(self, func):
----------
func : function
Function to apply, should return boolean
axis : tuple or int, optional, default=(0,)
Axis or multiple axes to filter along.
"""

if self.mode == 'local':
Expand Down Expand Up @@ -548,40 +557,24 @@ def func(record):
def plus(self, other):
"""
Elementwise addition.
See also
--------
elementwise
"""
return self.element_wise(other, add)

def minus(self, other):
"""
Elementwise subtraction.
See also
--------
elementwise
"""
return self.element_wise(other, subtract)

def dottimes(self, other):
"""
Elementwise multiplication.
See also
--------
elementwise
"""
return self.element_wise(other, multiply)

def dotdivide(self, other):
"""
Elementwise divison.
See also
--------
elementwise
"""
return self.element_wise(other, divide)

Expand Down

0 comments on commit 0fbdf89

Please sign in to comment.