Get business days between start and end date using pandas

0 votes
I'm using pandas and trying to find the easiest way to get the business days between a start and end date using pandas. How to do it?

I directly want to use  pandas as I think that pandas can probably handle this quite easy. Can anyone help?
Feb 15 in Python by ana1504.k
• 6,630 points
129 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
You can use BDay() to get the business days in range. For example -

from pandas.tseries.offsets import *

In [185]: s
Out[185]:
2011-01-01   -0.011629
2011-01-02   -0.089666
2011-01-03   -1.314430
2011-01-04   -1.867307
2011-01-05    0.779609
2011-01-06    0.588950
2011-01-07   -2.505803
2011-01-08    0.800262
2011-01-09    0.376406
2011-01-10   -0.469988
Freq: D

In [186]: s.asfreq(BDay())
Out[186]:
2011-01-03   -1.314430
2011-01-04   -1.867307
2011-01-05    0.779609
2011-01-06    0.588950
2011-01-07   -2.505803
2011-01-10   -0.469988
Freq: B
answered Feb 15 by SDeb
• 10,700 points

Related Questions In Python

0 votes
1 answer

When I create and remove files rapidly on windows using python I get WindowsError (Error 5)

Here's the short answer: disable any antivirus or ...READ MORE

answered Aug 31, 2018 in Python by charlie_brown
• 7,710 points
75 views
0 votes
1 answer
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
54 views
0 votes
2 answers

difference between class and instance attributes

Apart from the performance, there is a ...READ MORE

answered Sep 17, 2018 in Python by SDeb
• 10,700 points
22 views
0 votes
1 answer

Difference between module and Package in Python

A module is basically a single file ...READ MORE

answered Nov 13, 2018 in Python by SDeb
• 10,700 points
75 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.