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