0

Is it the same using capital or small letters when setting the frequency for Time Series / Date functionality in pandas?

is it the same using freq='d' or freq='D'?

Offset Aliases

A number of string aliases are given to useful common time series frequencies. We will refer to these aliases as offset aliases.

Alias   Description
B   business day frequency
C   custom business day frequency
D   calendar day frequency
W   weekly frequency
M   month end frequency
SM  semi-month end frequency (15th and end of month)
BM  business month end frequency
CBM custom business month end frequency
MS  month start frequency
SMS semi-month start frequency (1st and 15th)
BMS business month start frequency
CBMS    custom business month start frequency
Q   quarter end frequency
BQ  business quarter end frequency
QS  quarter start frequency
BQS business quarter start frequency
A, Y    year end frequency
BA, BY  business year end frequency
AS, YS  year start frequency
BAS, BYS    business year start frequency
BH  business hour frequency
H   hourly frequency
T, min  minutely frequency
S   secondly frequency
L, ms   milliseconds
U, us   microseconds
N   nanoseconds
2
  • What made you think they are different? Any specific cases you faced? As per my trials they are same. Commented Nov 10, 2017 at 15:22
  • a friend of mine that passed me the list of Offset Aliases
    – gabboshow
    Commented Nov 10, 2017 at 15:32

1 Answer 1

2

In docs are all values capital, check offset-aliases.

I try small check if it is same:

L= ['B','D','W','M','Q','H','T','S']

rng = pd.date_range('2017-04-03', periods=10)
df = pd.DataFrame({'a': range(10)}, index=rng)  
print (df)

for x in L:
    a  = df.resample(x.lower()).ffill() 
    b = df.resample(x).ffill()
    print ((a == b).all())

a    True
dtype: bool
a    True
dtype: bool
a    True
dtype: bool
a    True
dtype: bool
a    True
dtype: bool
a    True
dtype: bool
a    True
dtype: bool
a    True
dtype: bool
2
  • yep....I saw that they are capital...but always used small... that s why I was checking... I guess then it is the same...
    – gabboshow
    Commented Nov 10, 2017 at 15:35
  • 1
    I think yes, but maybe the best is keep values in docs - capitals.
    – jezrael
    Commented Nov 10, 2017 at 15:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.