gpt4 book ai didi

python-2.7 - Python 数据帧在微秒内重新采样

转载 作者:行者123 更新时间:2023-12-04 01:23:25 25 4
gpt4 key购买 nike

我正在使用重采样数据框,它可以在几小时、几天、几分钟内工作,但不会在几秒内重新采样。即使在很短的时间内,程序也会挂起。所以我错过了什么吗?

我尝试了 0.000001S、U 等......到目前为止没有任何效果。

我的时间格式:2015-08-29 19:30:47.015506

你可以看到变量 sf 代表重采样频率。

grph = df.set_index('Date and Time').resample(sf, len).astype(int)

如何以微秒粒度重新采样数据帧?

最佳答案

sf = "1U" #for one microsecond

对于毫秒/微秒/秒,请使用:
L       milliseonds
U microseconds
S seconds

Full doc :
B       business day frequency
C custom business day frequency (experimental)
D calendar day frequency
W weekly frequency
M month end frequency
BM business month end frequency
CBM custom business month end frequency
MS month start frequency
BMS business month start frequency
CBMS custom business month start frequency
Q quarter end frequency
BQ business quarter endfrequency
QS quarter start frequency
BQS business quarter start frequency
A year end frequency
BA business year end frequency
AS year start frequency
BAS business year start frequency
BH business hour frequency
H hourly frequency
T minutely frequency
S secondly frequency
L milliseonds
U microseconds
N nanoseconds

关于python-2.7 - Python 数据帧在微秒内重新采样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32313741/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com