{ "info": { "author": "Gnaneshwar G", "author_email": "gnaneshwar441@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "Business_Duration\n==================\n\nCalculates business duration in days, hours, minutes and seconds by\nexcluding weekends, public holidays and non-business hours\n\nHow to install the package\n--------------------------\npip install business-duration\n\nExample 1\n---------\n.. code:: python\n\n from business_duration import businessDuration\n import pandas as pd\n import holidays as pyholidays\n from datetime import time\n\n #Start date must be in standard python datetime format\n start_date = pd.to_datetime('2017-07-01 02:02:00')\n\n #Start date must be in standard python datetime format\n end_date = pd.to_datetime('2017-07-07 04:48:00')\n\n #Business open hour must be in standard python time format-Hour,Min,Sec\n biz_open_time=time(7,0,0)\n\n #Business close hour must be in standard python time format-Hour,Min,Sec\n biz_close_time=time(17,0,0)\n\n #US public holidays\n US_holiday_list = pyholidays.US(state='CA')\n\n #Business duration can be 'day', 'hour', 'min', 'sec'\n unit_hour='hour'\n\n #Printing output\n print(businessDuration(startdate=start_date,enddate=end_date,starttime=biz_open_time,endtime=biz_close_time,holidaylist=US_holiday_list,unit=unit_hour))\n\n #Result\n #30.0\n\n #Result is 30 hours because July 1st, 2nd are weekends and 4th is US public holiday. So 3 days remains with 10 business hours per day. 3 days*10 hours = 30 Hours\n\nExample 2\n---------\n\n.. code:: python\n\n from business_duration import businessDuration\n from datetime import datetime\n\n start_date = datetime.strptime(\"2018-01-01\",\"%Y-%m-%d\").date()\n end_date = datetime.strptime(\"2018-03-31\",\"%Y-%m-%d\").date()\n\n print(businessDuration(startdate=start_date,enddate=end_date,unit='day'))\n\n #Result\n 65.0\n\nExample 3\n---------\n\n.. code:: python\n\n import pandas as pd\n import holidays as pyholidays\n from datetime import time,datetime\n\n #Reading input file\n inputdata = pd.read_excel('Sample.xls')\n\n #Converting to standard Python datetime format\n inputdata.sys_created_on=pd.to_datetime(inputdata.sys_created_on,format='%Y-%m-%d %H:%M:%S')\n inputdata.resolved_at=pd.to_datetime(inputdata.resolved_at,format='%Y-%m-%d %H:%M:%S')\n\n #Business open hour\n biz_open_time = time(8,0,0)\n\n #Business close time\n biz_close_time = time(17,0,0)\n\n #Weekend list. 5-Sat, 6-Sun\n weekend_list = [5,6]\n\n #Custom US holidays\n US_holiday_list = {datetime(2018,1,1):\"New Year's Day\",datetime(2018,5,28):\"Memorial Day\",datetime(2018,7,4):\"Independence Day\",datetime(2018,9,3):\"Labor Day\",datetime(2018,11,22):\"Thanksgiving\",datetime(2018,12,25):\"Christmas Day\"}\n\n #Business duration 'day','hour','min','sec'\n unit_hour='hour'\n\n #Applying the function to entire dataframe\n from itertools import repeat\n inputdata['Biz_Hour'] = list(map(businessDuration,inputdata.sys_created_on,inputdata.resolved_at,repeat(biz_open_time),repeat(biz_close_time),repeat(weekend_list),repeat(US_holiday_list),repeat(unit_hour)))", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/gnaneshwar441/Business_Duration", "keywords": "business,duration,time,hour,day,working", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "business-duration", "package_url": "https://pypi.org/project/business-duration/", "platform": "", "project_url": "https://pypi.org/project/business-duration/", "project_urls": { "Homepage": "https://github.com/gnaneshwar441/Business_Duration" }, "release_url": "https://pypi.org/project/business-duration/0.61/", "requires_dist": null, "requires_python": "", "summary": "Calculates business duration in days, hours, minutes and seconds by excluding weekends, public holidays and non-business hours", "version": "0.61" }, "last_serial": 3856472, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "776b1651d7a028155d6d5dcf2bff55be", "sha256": "de9cb901677769fc2de257bf88d29d677b2586274f0add73b1647ce131ec702d" }, "downloads": -1, "filename": "business_duration-0.2.tar.gz", "has_sig": false, "md5_digest": "776b1651d7a028155d6d5dcf2bff55be", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2531, "upload_time": "2018-02-24T12:37:01", "url": "https://files.pythonhosted.org/packages/1a/87/3a32d110ff6986b9e433dec6de1bb1ca09bafa0291504ee6377d5f861c7e/business_duration-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "6579264999549c8c0102cfd1bf794f23", "sha256": "1641ccb6eead58f00e5cdbb83942b04b4891a81f690db3bb9bc361752b1422a0" }, "downloads": -1, "filename": "business_duration-0.3.tar.gz", "has_sig": false, "md5_digest": "6579264999549c8c0102cfd1bf794f23", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2535, "upload_time": "2018-02-25T17:35:09", "url": "https://files.pythonhosted.org/packages/f1/5f/64897ecc5f386c76bd38f31107762c9d6b0552c0ab34db8eacb2e62c6b64/business_duration-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "95ebe405be2d9e053978a775f103857d", "sha256": "b8954e88bb9040a9ac05e940dedfe8ce8f950ba959ced732269a680d9fde9314" }, "downloads": -1, "filename": "business_duration-0.4.tar.gz", "has_sig": false, "md5_digest": "95ebe405be2d9e053978a775f103857d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2824, "upload_time": "2018-02-25T17:58:17", "url": "https://files.pythonhosted.org/packages/fd/13/b606954499ee6329c067e9ef79fda37557644ca4dfb3e881b1efa42be575/business_duration-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "9401eca0688551324257ece9d10f46ea", "sha256": "146b1700b874e57ab3d0aeb4f522b51f8576c46ece81c81c7cb3bd3b319d77fb" }, "downloads": -1, "filename": "business_duration-0.5.tar.gz", "has_sig": false, "md5_digest": "9401eca0688551324257ece9d10f46ea", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2850, "upload_time": "2018-03-12T16:57:25", "url": "https://files.pythonhosted.org/packages/5e/c6/5118ac394b6bd6dbcaa0d5e726c16b182178000bbba656eb0ce7f25b15da/business_duration-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "aa1da2eee1b13c5ebe75da7304f2047a", "sha256": "c072fb3b46386e4bf81c719c43bfee04f502a83850b223acfbc8e746c922c081" }, "downloads": -1, "filename": "business_duration-0.6.tar.gz", "has_sig": false, "md5_digest": "aa1da2eee1b13c5ebe75da7304f2047a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2975, "upload_time": "2018-04-11T19:46:27", "url": "https://files.pythonhosted.org/packages/5f/ab/a8499242312565b7ad8b9c558b98aaaf553b1a8dd5109233422b2509f13c/business_duration-0.6.tar.gz" } ], "0.61": [ { "comment_text": "", "digests": { "md5": "521b0c33a3d453fb3f2e1768cb149066", "sha256": "d0275217eb3c0bf665dfadac87e7e52fa94c58245b947c40143afce02a26dcf0" }, "downloads": -1, "filename": "business_duration-0.61.tar.gz", "has_sig": false, "md5_digest": "521b0c33a3d453fb3f2e1768cb149066", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3439, "upload_time": "2018-05-12T11:08:46", "url": "https://files.pythonhosted.org/packages/45/47/4661aab790216216755ae77e5947c61aae68f92735ad68f4c49c0c25cb6d/business_duration-0.61.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "521b0c33a3d453fb3f2e1768cb149066", "sha256": "d0275217eb3c0bf665dfadac87e7e52fa94c58245b947c40143afce02a26dcf0" }, "downloads": -1, "filename": "business_duration-0.61.tar.gz", "has_sig": false, "md5_digest": "521b0c33a3d453fb3f2e1768cb149066", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3439, "upload_time": "2018-05-12T11:08:46", "url": "https://files.pythonhosted.org/packages/45/47/4661aab790216216755ae77e5947c61aae68f92735ad68f4c49c0c25cb6d/business_duration-0.61.tar.gz" } ] }