Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Data Frame resample on micro second

I am working with resampling data frame and it works on hours, days mins, but doesn't resample less then sec. Program just hangs even on short time span. So am I missing something?

I tried 0.000001S, U etc... Nothing worked so far.

my time format: 2015-08-29 19:30:47.015506

you can see varable sf represent resampling freq.

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

How can I resample data frame on micro seconds granularity?

like image 211
alphiii Avatar asked Dec 05 '22 02:12

alphiii


1 Answers

sf = "1U" #for one microsecond

For milliseconds/microseconds/seconds use:

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
like image 95
YOBA Avatar answered Dec 06 '22 16:12

YOBA