From fa1dc75b3b8c484f62adfd952e6d33aba44cf808 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Fri, 8 Dec 2017 11:27:23 -0800 Subject: [PATCH 1/3] add benchmarks for timestamp parsing --- asv_bench/benchmarks/timestamp.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/asv_bench/benchmarks/timestamp.py b/asv_bench/benchmarks/timestamp.py index c8a93b09d94c0..1be4f0ffb1de0 100644 --- a/asv_bench/benchmarks/timestamp.py +++ b/asv_bench/benchmarks/timestamp.py @@ -2,6 +2,24 @@ import pytz import datetime +class TimestampConstruction(object): + # TODO: classmethod constructors: fromordinal, fromtimestamp... + + def time_parse_iso8601_no_tz(self): + Timestamp('2017-08-25 08:16:14') + + def time_parse_iso8601_tz(self): + Timestamp('2017-08-25 08:16:14-0500') + + def time_parse_dateutil(self): + Timestamp('2017/08/25 08:16:14 AM') + + def time_parse_today(self): + Timestamp('today') + + def time_parse_now(self): + Timestamp('now') + class TimestampProperties(object): goal_time = 0.2 From 6a084e39e2848698d97625ca5a4d22167852e80e Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Fri, 8 Dec 2017 11:29:37 -0800 Subject: [PATCH 2/3] flake8 cleanup --- asv_bench/benchmarks/timestamp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/asv_bench/benchmarks/timestamp.py b/asv_bench/benchmarks/timestamp.py index 1be4f0ffb1de0..62abaca17d22f 100644 --- a/asv_bench/benchmarks/timestamp.py +++ b/asv_bench/benchmarks/timestamp.py @@ -1,7 +1,8 @@ -from pandas import to_timedelta, Timestamp +from pandas import Timestamp import pytz import datetime + class TimestampConstruction(object): # TODO: classmethod constructors: fromordinal, fromtimestamp... From 75e5cc3a7e7512c83c8b3e03f96457fcb3d8f918 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Fri, 8 Dec 2017 11:31:40 -0800 Subject: [PATCH 3/3] flake8 fixup of timedelta, enable linting for Ts --- asv_bench/benchmarks/timedelta.py | 10 ++++++---- ci/lint.sh | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/asv_bench/benchmarks/timedelta.py b/asv_bench/benchmarks/timedelta.py index 2d1ff3a24f787..f99f95678a0b7 100644 --- a/asv_bench/benchmarks/timedelta.py +++ b/asv_bench/benchmarks/timedelta.py @@ -1,5 +1,7 @@ -from .pandas_vb_common import * -from pandas import to_timedelta, Timestamp +import numpy as np +import pandas as pd + +from pandas import to_timedelta, Timestamp, Timedelta class ToTimedelta(object): @@ -67,8 +69,8 @@ class DatetimeAccessor(object): def setup(self): self.N = 100000 self.series = pd.Series( - pd.timedelta_range('1 days', periods=self.N, freq='h') - ) + pd.timedelta_range('1 days', periods=self.N, freq='h')) + def time_dt_accessor(self): self.series.dt diff --git a/ci/lint.sh b/ci/lint.sh index 832e1227d9752..bec82602fa509 100755 --- a/ci/lint.sh +++ b/ci/lint.sh @@ -24,7 +24,7 @@ if [ "$LINT" ]; then echo "Linting setup.py DONE" echo "Linting asv_bench/benchmarks/" - flake8 asv_bench/benchmarks/ --exclude=asv_bench/benchmarks/[ghijoprst]*.py --ignore=F811 + flake8 asv_bench/benchmarks/ --exclude=asv_bench/benchmarks/[ghijoprs]*.py --ignore=F811 if [ $? -ne "0" ]; then RET=1 fi