What are the valid parameters date offset strings in pandas? -


various pandas functions allow argument specify frequencies, e.g. freq in

pd.date_range('1/1/2011', periods=72, freq='h') 

(source)

and first argument in

series.resample('3t', how='sum', label='right') 

(source)

i can figure out empirically h , 3t mean, if want create own frequencies i'm stuck. these parameters, , how can find out how form own?

the valid frequency codes can found in documentation under offset aliases. next sections, combining aliases , anchored offsets, relevant.

essentially, number see preceding offset alias multiplier offset alias. example, t means minutely, 3t means every 3 minutes.

pd.date_range('2015-01-01', periods=3, freq='t') datetimeindex(['2015-01-01 00:00:00', '2015-01-01 00:01:00', '2015-01-01 00:02:00'], dtype='datetime64[ns]', freq='t')  pd.date_range('2015-01-01', periods=3, freq='3t') datetimeindex(['2015-01-01 00:00:00', '2015-01-01 00:03:00', '2015-01-01 00:06:00'], dtype='datetime64[ns]', freq='3t') 

you can combine offset aliases. example, 2h3t frequency of every 2 hours , 3 minutes. order in offset aliases combined not matter; 2h3t equivalent 3t2h. note there offset aliases not combine, e.g. ms , t.

anchored offsets allow modify when of potentially ambiguous offset alias start/stop. example, weekly offset w implicitly has week start on sunday. if want week start on thursday, use thursday anchor: w-thu.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo