python - Pandas resample by first day in my data -


i have yahoo finance daily stock price imported in pandas dataframe. want use .resample() convert monthly stock price taking price of first quoted daily price of each month.

.resample('ms', how='first') 

returns correct price of each month but changes index first day of month while in general first day of month quoted price maybe 2nd or 3rd of month because of holidays , weekends.

how can use resample() resampling existing dates , not changing them?

i think want bms (business month start):

.resample('bms', how='first') 

an alternative groupby month , take first plain ol' groupby (and e.g. use nth first entry in each group):

.groupby(pd.timegrouper('m')).nth(0) 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -