Skip to content

tslib flake8 cleanup, missing declarations #17907

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 11 commits into from
Oct 20, 2017
Prev Previous commit
Next Next commit
Use (faster) dict lookup instead of _get_named_field; remove now-unus…
…ed method
  • Loading branch information
jbrockmendel committed Oct 17, 2017
commit 6a1e7ef16dd7593144606fc47a0dd64cbc54022f
15 changes: 5 additions & 10 deletions pandas/_libs/tslib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,11 @@ class Timestamp(_Timestamp):
return self.weekday()

@property
def weekday_name(self):
return self._get_named_field('weekday_name')
def str weekday_name(self):
cdef dict wdays = {0: 'Monday', 1: 'Tuesday', 2: 'Wednesday',
3: 'Thursday', 4: 'Friday', 5: 'Saturday',
6: 'Sunday'}
return wdays[self.weekday()]

@property
def dayofyear(self):
Expand Down Expand Up @@ -1350,14 +1353,6 @@ cdef class _Timestamp(datetime):
out = get_date_field(np.array([val], dtype=np.int64), field)
return int(out[0])

cdef _get_named_field(self, field):
cdef:
int64_t val
ndarray[object] out
val = self._maybe_convert_value_to_local()
out = get_date_name_field(np.array([val], dtype=np.int64), field)
return out[0]

cdef _get_start_end_field(self, field):
month_kw = self.freq.kwds.get(
'startingMonth', self.freq.kwds.get(
Expand Down