Skip to content

Avoid importing from pandas at _libs files #31977

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

Conversation

ShaharNaveh
Copy link
Member

@ShaharNaveh ShaharNaveh commented Feb 14, 2020

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

Something that brought at to me at first here


cc @jbrockmendel

@ShaharNaveh ShaharNaveh reopened this Feb 14, 2020
@WillAyd
Copy link
Member

WillAyd commented Feb 14, 2020

What is the benefit of doing this? I think I prefer it as is so we have only one way of testing for 32 bit

@ShaharNaveh
Copy link
Member Author

@WillAyd TBH I don't really know, all I do know is that one time I imported pandas.compat at the top, and I was requested to change it.

@jbrockmendel
Copy link
Member

@MomIsBestFriend is right that in general we try to avoid non-_libs imports in _libs, but that rule is not hard-and-fast, e.g. _libs.parsers is all over the place. tslibs is the only place where im really adamant about this.

cdef:
float64_t INF = <float64_t>np.inf
float64_t NEGINF = -INF

int64_t NPY_NAT = util.get_nat()

bint is_32bit = is_platform_32bit()
Copy link
Member

Choose a reason for hiding this comment

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

can you do bint is_32bit = platform.architecture()[0] == "32-bit" and avoid re-computing at runtime?

@WillAyd
Copy link
Member

WillAyd commented Feb 14, 2020

Unless there is a performance improvement I'd be -1 on this change

@jreback
Copy link
Contributor

jreback commented Feb 16, 2020

what actually need is a cython version of compat that we can use; this is not what we are going for.

@jreback jreback closed this Feb 16, 2020
@ShaharNaveh ShaharNaveh deleted the Avoid-import-from-pandas-at-libs branch February 29, 2020 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants