python-dateutil

Permission Denied while trying to run a Python package

梦想的初衷 提交于 2019-12-11 10:29:28
问题 I'm trying to use a Python package called csvkit on an AWS EC2 machine. I was able to install it after some hiccups, which might be related - running pip install csvkit threw an error at with open(path, 'rb') as stream: IOERROR: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/python_dateutil-2.2-py2.7.egg/EGG-INFO/requires.txt' But I was able to install it with some other command. Now onto the original problem - when I try to run a simple function within the csvkit

Dateutil parse bug in python returns the wrong value

你。 提交于 2019-12-11 04:13:30
问题 I have looked at many possible ways to parse python times. Using parse seems link the only method that should work. While trying to use datetime.strptime causes an error because %z does not work with python 2.7. But using parse.parse incorrectly recognizes the time zone. I parse both Fri Nov 9 09:04:02 2012 -0500 and Fri Nov 9 09:04:02 2012 -0800 and get the exact same timestamp in unix time. 1352480642 My version of python 2.7.10 My version of dateutil 1.5 Here is my code that runs the test.

parse multiple dates using dateutil

我与影子孤独终老i 提交于 2019-12-10 17:41:51
问题 I am trying to parse multiple dates from a string in Python with the help of this code, from dateutil.parser import _timelex, parser a = "Approve my leave from first half of 12/10/2012 to second half of 20/10/2012 " p = parser() info = p.info def timetoken(token): try: float(token) return True except ValueError: pass return any(f(token) for f in (info.jump,info.weekday,info.month,info.hms,info.ampm,info.pertain,info.utczone,info.tzoffset)) def timesplit(input_string): batch = [] for token in

Python: How to compare two date/time?

可紊 提交于 2019-12-10 11:41:26
问题 I have the following two date/time which are date_time1 and date_time2 respectively: 2017-04-15 00:00:00 2017-04-17 15:35:19+00:00 parsed1 = dateutil.parser.parse(date_time1) parsed2 = dateutil.parser.parse(date_time2) and would if I were to receive another date/time called input_date_time (e.g. 2017-04-16 12:11:42+00:00), would like to do the following: # Would like to check if `input_date_time` is within the range if parsed1 <= input_date_time <= parsed2: … And got an error: TypeError: can

How to extract time date period information from raw sentences in Python

岁酱吖の 提交于 2019-12-08 00:27:49
问题 Input: Valid for ticketing and travelling Starting from Mar 27 2016 to Dec 31 2016 Effective Period Tickets must be issued on before 18 FEB 16 Effective Period Ticket must be issued on before 29 FEB 2016 TRAVELING DATES NOW - FEB 10 2016 FEB 22 2016 - MAY 12 2016 Ticketing Effective Period on before 31 Jan 2016 (Note: The input has been preprocessed to this stage by some Python codes so that it will be easier to process using some Python packages.) Expected output: from 2016-03-27 to 2016-12

dateutils rrule returns dates that 2 months apart

你说的曾经没有我的故事 提交于 2019-12-07 23:43:01
问题 I am new to Python and also dateutil module. I am passing the following arguments: disclosure_start_date = resultsDict['fd_disclosure_start_date'] disclosure_end_date = datetime.datetime.now() disclosure_dates = [dt for dt in rrule(MONTHLY, dtstart=disclosure_start_date, until=disclosure_end_date)] Here disclosure_start_date = 2012-10-31 00:00:00 which converted to datetime is datetime.datetime(2012, 10, 31, 0, 0) End date is as of now. When I use: disclosure_dates = [dt for dt in rrule

Extraction of some date formats failed when using Dateutil in Python

≯℡__Kan透↙ 提交于 2019-12-06 15:40:33
I have gone through multiple links before posting this question so please read through and below are the two answers which have solved 90% of my problem: parse multiple dates using dateutil How to parse multiple dates from a block of text in Python (or another language) Problem : I need to parse multiple dates in multiple formats in Python Solution by Above Links : I am able to do so but there are still certain formats which I am not able to do so. Formats which still can't be parsed are: text ='I want to visit from May 16-May 18' text ='I want to visit from May 16-18' text ='I want to visit

How to extract time date period information from raw sentences in Python

点点圈 提交于 2019-12-06 06:38:58
Input: Valid for ticketing and travelling Starting from Mar 27 2016 to Dec 31 2016 Effective Period Tickets must be issued on before 18 FEB 16 Effective Period Ticket must be issued on before 29 FEB 2016 TRAVELING DATES NOW - FEB 10 2016 FEB 22 2016 - MAY 12 2016 Ticketing Effective Period on before 31 Jan 2016 (Note: The input has been preprocessed to this stage by some Python codes so that it will be easier to process using some Python packages.) Expected output: from 2016-03-27 to 2016-12-31 on before 2016-02-18 on before 2016-02-29 now - 2016-02-10 2016-02-22 - 2016-05-12 on before 2016-01

dateutils rrule returns dates that 2 months apart

独自空忆成欢 提交于 2019-12-06 05:50:21
I am new to Python and also dateutil module. I am passing the following arguments: disclosure_start_date = resultsDict['fd_disclosure_start_date'] disclosure_end_date = datetime.datetime.now() disclosure_dates = [dt for dt in rrule(MONTHLY, dtstart=disclosure_start_date, until=disclosure_end_date)] Here disclosure_start_date = 2012-10-31 00:00:00 which converted to datetime is datetime.datetime(2012, 10, 31, 0, 0) End date is as of now. When I use: disclosure_dates = [dt for dt in rrule(MONTHLY, dtstart=disclosure_start_date, until=disclosure_end_date)] I get the dates for every other month or

Using python pandas to parse CSV with date in format Year, Day, Hour, Min, Sec

强颜欢笑 提交于 2019-12-06 03:58:08
问题 I have several CSV files with the format: Year,Day,Hour,Min,Sec.,P1'S1 2003, 1, 0, 0,12.22, 0.541 2003, 1, 1, 0,20.69, 0.708 2003, 1, 2, 0, 4.95, 0.520 2003, 1, 3, 0,13.42, 0.539 ... (where day , is the day of the year ) and I'm trying to read them using the pandas library (seems a fantastic lib so far). There is a built-in function to read CSV in pandas, and even better, that function supposedly checks the columns for a date type. and automatically uses that as an index (which would be