Skip to content
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

Remove property that re-computed microsecond #17331

Merged
merged 6 commits into from
Sep 7, 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
60 changes: 60 additions & 0 deletions asv_bench/benchmarks/timestamp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from .pandas_vb_common import *
from pandas import to_timedelta, Timestamp


class TimestampProperties(object):
goal_time = 0.2

def setup(self):
self.ts = Timestamp('2017-08-25 08:16:14')

def time_tz(self):
self.ts.tz

def time_offset(self):
self.ts.offset

def time_dayofweek(self):
self.ts.dayofweek

def time_weekday_name(self):
self.ts.weekday_name

def time_dayofyear(self):
self.ts.dayofyear

def time_week(self):
self.ts.week

def time_quarter(self):
self.ts.quarter

def time_days_in_month(self):
self.ts.days_in_month

def time_freqstr(self):
self.ts.freqstr

def time_is_month_start(self):
self.ts.is_month_start

def time_is_month_end(self):
self.ts.is_month_end

def time_is_quarter_start(self):
self.ts.is_quarter_start

def time_is_quarter_end(self):
self.ts.is_quarter_end

def time_is_year_start(self):
self.ts.is_quarter_end

def time_is_year_end(self):
self.ts.is_quarter_end

def time_is_leap_year(self):
self.ts.is_quarter_end

def time_microsecond(self):
self.ts.microsecond
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.21.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ Performance Improvements

- Improved performance of instantiating :class:`SparseDataFrame` (:issue:`16773`)
- :attr:`Series.dt` no longer performs frequency inference, yielding a large speedup when accessing the attribute (:issue:`17210`)

- :attr:`Timestamp.microsecond` no longer re-computes on attribute access (:issue:`17331`)

.. _whatsnew_0210.bug_fixes:

Expand Down
1 change: 1 addition & 0 deletions pandas/_libs/period.pyx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from datetime import datetime, date, timedelta
import operator

Expand Down
4 changes: 0 additions & 4 deletions pandas/_libs/tslib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,6 @@ class Timestamp(_Timestamp):

weekofyear = week

@property
def microsecond(self):
return self._get_field('us')

@property
def quarter(self):
return self._get_field('q')
Expand Down