Update date_parser.py (#17426)

This commit is contained in:
John Bodley 2021-11-12 11:26:18 -08:00 committed by GitHub
parent bcef8fa13b
commit bfc813dea2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -324,7 +324,9 @@ class EvalDateTruncFunc: # pylint: disable=too-few-public-methods
month=1, day=1, hour=0, minute=0, second=0, microsecond=0
)
if unit == "quarter":
dttm = pd.Period(pd.Timestamp(dttm), freq="Q").to_timestamp()
dttm = (
pd.Period(pd.Timestamp(dttm), freq="Q").to_timestamp().to_pydatetime()
)
elif unit == "month":
dttm = dttm.replace(day=1, hour=0, minute=0, second=0, microsecond=0)
elif unit == "week":