Exemplo n.º 1
0
 def astype(self, dtype):
     if dtype == 'int' or dtype is int:
         r = MIArray(ArrayUtil.toInteger(self.array))
     elif dtype == 'float' or dtype is float:
         r = MIArray(ArrayUtil.toFloat(self.array))
     else:
         r = self
     return r
Exemplo n.º 2
0
 def astype(self, dtype):
     if dtype == 'int' or dtype is int:
         r = MIArray(ArrayUtil.toInteger(self.array))
     elif dtype == 'float' or dtype is float:
         r = MIArray(ArrayUtil.toFloat(self.array))
     else:
         r = self
     return r
Exemplo n.º 3
0
 def astype(self, dtype):
     '''
     Convert to another data type.
     
     :param dtype: (*string*) Data type.
     
     :returns: (*array*) Converted array.
     '''
     if dtype == 'int' or dtype is int:
         r = MIArray(ArrayUtil.toInteger(self.array))
     elif dtype == 'float' or dtype is float:
         r = MIArray(ArrayUtil.toFloat(self.array))
     elif dtype == 'boolean' or dtype is bool:
         r = MIArray(ArrayUtil.toBoolean(self.array))
     else:
         r = self
     return r
Exemplo n.º 4
0
 def astype(self, dtype):
     '''
     Convert to another data type.
     
     :param dtype: (*string*) Data type.
     
     :returns: (*array*) Converted array.
     '''
     if dtype == 'int' or dtype is int:
         r = MIArray(ArrayUtil.toInteger(self.array))
     elif dtype == 'float' or dtype is float:
         r = MIArray(ArrayUtil.toFloat(self.array))
     elif dtype == 'boolean' or dtype == 'bool' or dtype is bool:
         r = MIArray(ArrayUtil.toBoolean(self.array))
     else:
         r = self
     return r