Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc changes to Base and Data classes #349

Merged
merged 2 commits into from
Jul 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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