本文整理汇总了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)