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


Python tslib.ints_to_pydatetime方法代码示例

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


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

示例1: __iter__

# 需要导入模块: from pandas._libs import tslib [as 别名]
# 或者: from pandas._libs.tslib import ints_to_pydatetime [as 别名]
def __iter__(self):
        """
        Return an iterator over the boxed values

        Yields
        -------
        tstamp : Timestamp
        """

        # convert in chunks of 10k for efficiency
        data = self.asi8
        length = len(self)
        chunksize = 10000
        chunks = int(length / chunksize) + 1
        for i in range(chunks):
            start_i = i * chunksize
            end_i = min((i + 1) * chunksize, length)
            converted = tslib.ints_to_pydatetime(data[start_i:end_i],
                                                 tz=self.tz, freq=self.freq,
                                                 box="timestamp")
            for v in converted:
                yield v 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:24,代码来源:datetimes.py

示例2: _convert_datetimelike_to_object

# 需要导入模块: from pandas._libs import tslib [as 别名]
# 或者: from pandas._libs.tslib import ints_to_pydatetime [as 别名]
def _convert_datetimelike_to_object(x):
    # coerce datetimelike array to object dtype

    # if dtype is of datetimetz or timezone
    if x.dtype.kind == _NS_DTYPE.kind:
        if getattr(x, 'tz', None) is not None:
            x = x.astype(object).values
        else:
            shape = x.shape
            x = tslib.ints_to_pydatetime(x.view(np.int64).ravel(),
                                         box="timestamp")
            x = x.reshape(shape)

    elif x.dtype == _TD_DTYPE:
        shape = x.shape
        x = tslib.ints_to_pytimedelta(x.view(np.int64).ravel(), box=True)
        x = x.reshape(shape)

    return x 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:21,代码来源:concat.py

示例3: to_pydatetime

# 需要导入模块: from pandas._libs import tslib [as 别名]
# 或者: from pandas._libs.tslib import ints_to_pydatetime [as 别名]
def to_pydatetime(self):
        """
        Return Datetime Array/Index as object ndarray of datetime.datetime
        objects

        Returns
        -------
        datetimes : ndarray
        """
        return tslib.ints_to_pydatetime(self.asi8, tz=self.tz) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:12,代码来源:datetimes.py

示例4: time

# 需要导入模块: from pandas._libs import tslib [as 别名]
# 或者: from pandas._libs.tslib import ints_to_pydatetime [as 别名]
def time(self):
        """
        Returns numpy array of datetime.time. The time part of the Timestamps.
        """
        # If the Timestamps have a timezone that is not UTC,
        # convert them into their i8 representation while
        # keeping their timezone and not using UTC
        if self.tz is not None and not timezones.is_utc(self.tz):
            timestamps = self._local_timestamps()
        else:
            timestamps = self.asi8

        return tslib.ints_to_pydatetime(timestamps, box="time") 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:15,代码来源:datetimes.py

示例5: timetz

# 需要导入模块: from pandas._libs import tslib [as 别名]
# 或者: from pandas._libs.tslib import ints_to_pydatetime [as 别名]
def timetz(self):
        """
        Returns numpy array of datetime.time also containing timezone
        information. The time part of the Timestamps.
        """
        return tslib.ints_to_pydatetime(self.asi8, self.tz, box="time") 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:8,代码来源:datetimes.py

示例6: date

# 需要导入模块: from pandas._libs import tslib [as 别名]
# 或者: from pandas._libs.tslib import ints_to_pydatetime [as 别名]
def date(self):
        """
        Returns numpy array of python datetime.date objects (namely, the date
        part of Timestamps without timezone information).
        """
        # If the Timestamps have a timezone that is not UTC,
        # convert them into their i8 representation while
        # keeping their timezone and not using UTC
        if self.tz is not None and not timezones.is_utc(self.tz):
            timestamps = self._local_timestamps()
        else:
            timestamps = self.asi8

        return tslib.ints_to_pydatetime(timestamps, box="date") 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:16,代码来源:datetimes.py

示例7: _where_compat

# 需要导入模块: from pandas._libs import tslib [as 别名]
# 或者: from pandas._libs.tslib import ints_to_pydatetime [as 别名]
def _where_compat(mask, arr1, arr2):
    if arr1.dtype == _NS_DTYPE and arr2.dtype == _NS_DTYPE:
        new_vals = np.where(mask, arr1.view('i8'), arr2.view('i8'))
        return new_vals.view(_NS_DTYPE)

    if arr1.dtype == _NS_DTYPE:
        arr1 = tslib.ints_to_pydatetime(arr1.view('i8'))
    if arr2.dtype == _NS_DTYPE:
        arr2 = tslib.ints_to_pydatetime(arr2.view('i8'))

    return np.where(mask, arr1, arr2) 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:13,代码来源:common.py


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