本文整理匯總了Python中MA.isMaskedArray方法的典型用法代碼示例。如果您正苦於以下問題:Python MA.isMaskedArray方法的具體用法?Python MA.isMaskedArray怎麽用?Python MA.isMaskedArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MA
的用法示例。
在下文中一共展示了MA.isMaskedArray方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_store_chain
# 需要導入模塊: import MA [as 別名]
# 或者: from MA import isMaskedArray [as 別名]
def get_store_chain(self, data, mask=None):
"""
Return a chain of generators for processing the src data,
which can either be a list or an iterable.
"""
multisourcecols = self.multisourcecols or self.heterosourcecols
if multisourcecols:
src = self._multisrc_gen(multisourcecols)
else:
src = iter(data)
if MA.isMaskedArray(data) and mask is None:
mask = data.mask()
if mask is not None:
src = self._mask_gen(src, mask)
if self.is_multivalue():
src = self._tuple_gen(src, self.ignorenone)
if self.missingvalues:
src = self._tuplemissing_gen(src, self.missingvalues)
else:
if self.calculatedby:
src = self._calcby_gen(src, self.calculatedby,
self.calculatedargs)
if self.missingvalues:
src = self._missing_gen(src, self.missingvalues)
src = self._storedata_gen(src)
return src
示例2: __setitem__
# 需要導入模塊: import MA [as 別名]
# 或者: from MA import isMaskedArray [as 別名]
def __setitem__(self, key, a):
index = self.dict.get(key)
if index is None:
if MA.isMaskedArray(a):
index = self._save_new_masked(a)
elif type(a) == Numeric.ArrayType:
index = self._save_new_array(a)
elif type(a) == types.StringType:
index = self._save_new_str(a)
else:
index = self._save_new_str(repr(a))
self.dict[key] = index
self.dict_dirty = 1
else:
if MA.isMaskedArray(a):
self._save_masked(index, a)
elif type(a) == Numeric.ArrayType:
self._save_array(index, a)
elif type(a) == types.StringType:
self._save_str(index, a)
else:
index = self._save_str(index, repr(a))
示例3: summ_to_array
# 需要導入模塊: import MA [as 別名]
# 或者: from MA import isMaskedArray [as 別名]
def summ_to_array(ds, measure, debug=False):
from SOOMv0.CrossTab import CrossTab
ct = CrossTab.from_summset(ds)
data = ct[measure].data
if MA.isMaskedArray(data):
data = data.filled() # Dealing with frequencies, so this is valid.
data = data.astype(Numeric.Float64)
if debug: print type(data)
if debug: print data
array = r.as_array(data)
dimnames = []
labels = []
for axis in ct.axes:
dimnames.append([axis.col.do_outtrans(v) for v in axis.values])
labels.append(axis.col.label or axis.col.name)
dimnames = r.list(*dimnames)
dimnames = r.names__(dimnames, labels)
array = r.dimnames__(array, dimnames)
if debug: r.print_(array)
return array
示例4: take
# 需要導入模塊: import MA [as 別名]
# 或者: from MA import isMaskedArray [as 別名]
def take(self, rows):
array = self.blob.as_array()
if MA.isMaskedArray(array):
return MA.take(array, rows)
else:
return Numeric.take(array, rows)