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
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
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