当前位置: 首页>>代码示例>>Python>>正文


Python NP.int64方法代码示例

本文整理汇总了Python中augustus.core.NumpyInterface.NP.int64方法的典型用法代码示例。如果您正苦于以下问题:Python NP.int64方法的具体用法?Python NP.int64怎么用?Python NP.int64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在augustus.core.NumpyInterface.NP的用法示例。


在下文中一共展示了NP.int64方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _stringToValue_date

# 需要导入模块: from augustus.core.NumpyInterface import NP [as 别名]
# 或者: from augustus.core.NumpyInterface.NP import int64 [as 别名]
    def _stringToValue_date(self, string):
        regex = re.match(self._iso8601_date, string)
        if regex is None:
            raise ValueError("invalid ISO 8601 date string: \"%s\"" % string)

        year = regex.group(1)
        month = regex.group(3)
        day = regex.group(5)
        
        try:
            if year is not None and month is not None and day is not None:
                dateTimeObject = datetime.datetime(int(year), int(month), int(day))

            elif year is not None and month is not None:
                dateTimeObject = datetime.datetime(int(year), int(month), 1)

            elif year is not None:
                dateTimeObject = datetime.datetime(int(year), 1, 1)

            else:
                raise ValueError

        except ValueError:
            raise ValueError("invalid ISO 8601 date string: \"%s\"" % string)

        td = dateTimeObject - self._dateTimeOrigin
        return NP.int64(td.days*86400 * self._dateTimeResolution)
开发者ID:Huskyeder,项目名称:augustus,代码行数:29,代码来源:FieldType.py

示例2: _stringToValue_time

# 需要导入模块: from augustus.core.NumpyInterface import NP [as 别名]
# 或者: from augustus.core.NumpyInterface.NP import int64 [as 别名]
    def _stringToValue_time(self, string):
        regex = re.match(self._iso8601_time, string)
        if regex is None:
            raise ValueError("invalid ISO 8601 time string: \"%s\"" % string)

        hour = regex.group(1)
        minute = regex.group(2)
        second = regex.group(4)
        subsecond = regex.group(5)
        timezone = regex.group(6)

        timezoneOffset = 0
        try:
            if hour is not None and minute is not None and second is not None:
                if subsecond is None:
                    microsecond = 0
                else:
                    microsecond = int(round(float(subsecond) * 1e6))
                dateTimeObject = datetime.datetime(1970, 1, 1, int(hour), int(minute), int(second), microsecond)

            elif hour is not None and minute is not None:
                if subsecond is not None:
                    raise ValueError
                dateTimeObject = datetime.datetime(1970, 1, 1, int(hour), int(minute))

            if timezone is not None:
                regex2 = re.match(self._timezone, timezone)
                if regex2 is not None:
                    sign, hourOffset, minuteOffset = regex2.groups()
                    timezoneOffset = ((int(hourOffset) * 60) + int(minuteOffset)) * 60 * self._dateTimeResolution   # microseconds
                    if sign == "-":
                        timezoneOffset *= -1

        except ValueError:
            raise ValueError("invalid ISO 8601 time string: \"%s\"" % string)

        td = dateTimeObject - self._dateTimeOrigin
        return NP.int64(td.seconds * self._dateTimeResolution + td.microseconds - timezoneOffset)
开发者ID:Huskyeder,项目名称:augustus,代码行数:40,代码来源:FieldType.py

示例3: _stringToValue_dateTime

# 需要导入模块: from augustus.core.NumpyInterface import NP [as 别名]
# 或者: from augustus.core.NumpyInterface.NP import int64 [as 别名]
    def _stringToValue_dateTime(self, string):
        # accept all of the ISO 8601 standards as well as the variants in which:
        #     the literal "T" is replaced by a space " "
        #     the hyphen delimiters "-" are replaced by slashes "/"
        #     the timezone is not specified

        regex = re.match(self._iso8601, string)
        if regex is None:
            raise ValueError("invalid ISO 8601 dateTime string: \"%s\"" % string)

        year = regex.group(1)
        month = regex.group(3)
        day = regex.group(5)
        hour = regex.group(7)
        minute = regex.group(8)
        second = regex.group(10)
        subsecond = regex.group(11)
        timezone = regex.group(12)

        timezoneOffset = 0
        try:
            if year is not None and month is not None and day is not None and hour is not None and minute is not None:
                if second is not None:
                    if subsecond is None:
                        microsecond = 0
                    else:
                        microsecond = int(round(float(subsecond) * 1e6))
                    dateTimeObject = datetime.datetime(int(year), int(month), int(day), int(hour), int(minute), int(second), microsecond)
                else:
                    if subsecond is not None:
                        raise ValueError
                    dateTimeObject = datetime.datetime(int(year), int(month), int(day), int(hour), int(minute))

                if timezone is not None:
                    regex2 = re.match(self._timezone, timezone)
                    if regex2 is not None:
                        sign, hourOffset, minuteOffset = regex2.groups()
                        timezoneOffset = ((int(hourOffset) * 60) + int(minuteOffset)) * 60 * self._dateTimeResolution   # microseconds
                        if sign == "-":
                            timezoneOffset *= -1

            elif year is not None and month is not None and day is not None and hour is not None:
                raise ValueError

            elif year is not None and month is not None and day is not None:
                dateTimeObject = datetime.datetime(int(year), int(month), int(day))

            elif year is not None and month is not None:
                dateTimeObject = datetime.datetime(int(year), int(month), 1)

            elif year is not None:
                dateTimeObject = datetime.datetime(int(year), 1, 1)

            else:
                raise ValueError

        except ValueError:
            raise ValueError("invalid ISO 8601 dateTime string: \"%s\"" % string)

        td = dateTimeObject - self._dateTimeOrigin
        return NP.int64((td.days*86400 + td.seconds) * self._dateTimeResolution + td.microseconds - timezoneOffset)
开发者ID:Huskyeder,项目名称:augustus,代码行数:63,代码来源:FieldType.py

示例4: _stringToValue_integer

# 需要导入模块: from augustus.core.NumpyInterface import NP [as 别名]
# 或者: from augustus.core.NumpyInterface.NP import int64 [as 别名]
 def _stringToValue_integer(self, string):
     return NP.int64(string)
开发者ID:Huskyeder,项目名称:augustus,代码行数:4,代码来源:FieldType.py

示例5: _stringToValue_dateTimeNumber

# 需要导入模块: from augustus.core.NumpyInterface import NP [as 别名]
# 或者: from augustus.core.NumpyInterface.NP import int64 [as 别名]
 def _stringToValue_dateTimeNumber(self, string):
     return (NP.int64(string) * self._factor) + self._offset
开发者ID:Huskyeder,项目名称:augustus,代码行数:4,代码来源:FieldType.py


注:本文中的augustus.core.NumpyInterface.NP.int64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。