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

Conversation

jbrockmendel
Copy link
Member

replace isinstance checks with the faster C versions
change cpdef-->cdef for internal field-getter methods
remove get_named_field in favor of faster dict lookup (yah yah I'll show asv results in a bit)

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fine. ping on green.

can you show updated benchmarks (for things that changed)

@@ -1669,6 +1666,7 @@ cpdef convert_str_to_tsobject(object ts, object tz, object unit,
cdef:
_TSObject obj
int out_local = 0, out_tzoffset = 0
datetime dtime
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call as dt (like below)

@jreback jreback added Code Style Code style, linting, code_checks Timedelta Timedelta data type Datetime Datetime data dtype labels Oct 17, 2017
@jbrockmendel
Copy link
Member Author

can you show updated benchmarks (for things that changed)

Should just be weekday_name property.

Old:

In [2]: ts = pd.Timestamp.now()
In [3]: ts2 = ts.tz_localize('Europe/Amsterdam')
In [4]: %timeit ts.weekday_name
10000 loops, best of 3: 79.5 µs per loop
In [5]: %timeit ts2.weekday_name
10000 loops, best of 3: 150 µs per loop

New:

In [2]: ts = pd.Timestamp.now()
In [3]: ts2 = ts.tz_localize('Europe/Amsterdam')
In [4]: %timeit ts.weekday_name
The slowest run took 11.97 times longer than the fastest. This could mean that an intermediate result is being cached.
100000 loops, best of 3: 4.92 µs per loop
In [5]: %timeit ts2.weekday_name
100000 loops, best of 3: 5.26 µs per loop

@jreback
Copy link
Contributor

jreback commented Oct 17, 2017

since it looks like you are doing flake8 fixups, can you edit the lint.sh script to pick these things up?
if some things are currently failing, just separate those out into a separate section (in the same scripts) with a comment and we can uncomment later.

@jbrockmendel
Copy link
Member Author

can you edit the lint.sh script to pick these things up?

Just added this to the TODO list.

@codecov
Copy link

codecov bot commented Oct 20, 2017

Codecov Report

Merging #17907 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17907      +/-   ##
==========================================
- Coverage   91.23%   91.22%   -0.02%     
==========================================
  Files         163      163              
  Lines       50105    50112       +7     
==========================================
- Hits        45715    45713       -2     
- Misses       4390     4399       +9
Flag Coverage Δ
#multiple 89.03% <ø> (ø) ⬆️
#single 40.31% <ø> (-0.06%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/compat/__init__.py 58.1% <0%> (-2.95%) ⬇️
pandas/core/common.py 91.18% <0%> (-1.63%) ⬇️
pandas/core/frame.py 97.75% <0%> (-0.1%) ⬇️
pandas/core/reshape/pivot.py 96.35% <0%> (-0.03%) ⬇️
pandas/core/dtypes/dtypes.py 95.14% <0%> (ø) ⬆️
pandas/plotting/_core.py 82.45% <0%> (ø) ⬆️
pandas/core/reshape/concat.py 97.58% <0%> (ø) ⬆️
pandas/core/series.py 95% <0%> (+0.01%) ⬆️
pandas/core/groupby.py 92.03% <0%> (+0.05%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5bf7f9a...5b461c8. Read the comment docs.

@jreback jreback added this to the 0.21.0 milestone Oct 20, 2017
@jreback jreback merged commit 77b4bb3 into pandas-dev:master Oct 20, 2017
@jreback
Copy link
Contributor

jreback commented Oct 20, 2017

thanks @jbrockmendel

yeemey pushed a commit to yeemey/pandas that referenced this pull request Oct 20, 2017
@jbrockmendel jbrockmendel deleted the tslibs-timestamp-fixup branch October 30, 2017 16:25
peterpanmj pushed a commit to peterpanmj/pandas that referenced this pull request Oct 31, 2017
alanbato pushed a commit to alanbato/pandas that referenced this pull request Nov 10, 2017
No-Stream pushed a commit to No-Stream/pandas that referenced this pull request Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks Datetime Datetime data dtype Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants