Skip to content

Remove from numpy cimport * #17521

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 7 commits into from
Sep 17, 2017
Merged

Conversation

jbrockmendel
Copy link
Member

Replace these imports with explicit imports.

There are a couple of other similar things coming up, splitting them apart for easier review.

There are a couple of places with cdef extern from "../src/headers/math.h": but I don't think the path here makes sense. The fact that it works anyway bothers me. This PR changes one such occurrence as a demonstration, leaves the others for the next PR.

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

cdef extern from "../src/headers/math.h":
double sqrt(double x) nogil
double fabs(double) nogil
from cpython.math cimport sqrt, fabs
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you want libc.math here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. Just pushed a fix.

@@ -1,16 +1,17 @@
# cython: profile=False

from numpy cimport *
cimport numpy as np
Copy link
Contributor

@chris-b1 chris-b1 Sep 13, 2017

Choose a reason for hiding this comment

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

we're inconsistent about this, but at least I prefer the cimport numpy as cnp, so it is clearer which parts need c-level access (edit: cnp)

Copy link
Contributor

Choose a reason for hiding this comment

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

agree here

Copy link
Member Author

Choose a reason for hiding this comment

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

Coming right up.


from numpy cimport (int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t,
from numpy cimport (ndarray,
int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t,
Copy link
Contributor

Choose a reason for hiding this comment

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

formatting

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@jreback jreback added the Compat pandas objects compatability with Numpy or Python functions label Sep 14, 2017
@codecov
Copy link

codecov bot commented Sep 15, 2017

Codecov Report

Merging #17521 into master will increase coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17521      +/-   ##
==========================================
+ Coverage   91.18%   91.23%   +0.04%     
==========================================
  Files         163      163              
  Lines       49543    49606      +63     
==========================================
+ Hits        45177    45256      +79     
+ Misses       4366     4350      -16
Flag Coverage Δ
#multiple 89.01% <ø> (+0.06%) ⬆️
#single 40.19% <ø> (-0.09%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.77% <0%> (-0.1%) ⬇️
pandas/core/indexes/datetimes.py 95.43% <0%> (-0.1%) ⬇️
pandas/core/dtypes/concat.py 98.26% <0%> (-0.03%) ⬇️
pandas/core/base.py 96.01% <0%> (ø) ⬆️
pandas/core/indexes/category.py 98.55% <0%> (ø) ⬆️
pandas/tseries/offsets.py 97.18% <0%> (+0.03%) ⬆️
pandas/core/indexes/period.py 92.77% <0%> (+0.03%) ⬆️
pandas/core/categorical.py 95.57% <0%> (+0.05%) ⬆️
pandas/core/common.py 91.98% <0%> (+0.32%) ⬆️
... and 4 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 f11bbf2...25520a3. Read the comment docs.

@jreback
Copy link
Contributor

jreback commented Sep 17, 2017

looks ok to me. @chris-b1

@jreback jreback added the Clean label Sep 17, 2017
@jreback jreback added this to the 0.21.0 milestone Sep 17, 2017
@jreback jreback merged commit 138be88 into pandas-dev:master Sep 17, 2017
@jreback
Copy link
Contributor

jreback commented Sep 17, 2017

thanks @jbrockmendel

jorisvandenbossche added a commit that referenced this pull request Sep 17, 2017
@jbrockmendel jbrockmendel deleted the cy_import_less branch October 30, 2017 16:24
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
Clean Compat pandas objects compatability with Numpy or Python functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants