Skip to content

add benchmarks for timestamp parsing #18698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions asv_bench/benchmarks/timedelta.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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

Expand Down
21 changes: 20 additions & 1 deletion asv_bench/benchmarks/timestamp.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
from pandas import to_timedelta, Timestamp
from pandas import Timestamp
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

Expand Down
2 changes: 1 addition & 1 deletion ci/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down