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

REF: Move pandas.core.categorical #19269

Merged

Conversation

TomAugspurger
Copy link
Contributor

Prep for #19268

"""
try:
codes = np.asarray(codes, np.int64)
except (ValueError, TypeError):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: I changed this from except Exception for the linter.

Copy link
Member

Choose a reason for hiding this comment

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

+1

msg = self._get_repr(length=False, footer=True).replace("\n", ", ")
result = ('[], {repr_msg}'.format(repr_msg=msg))

return re
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this unavoidable for older pickle files?

Copy link
Contributor

Choose a reason for hiding this comment

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

not sure what you are pointing to. but you need to have an entry in pandas.compat/pickle_compat.py to handle the pickle compat

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I thought we had something like that.

@TomAugspurger TomAugspurger added this to the 0.23.0 milestone Jan 16, 2018
@TomAugspurger TomAugspurger added Refactor Internal refactoring of code Categorical Categorical Data Type labels Jan 16, 2018
@TomAugspurger
Copy link
Contributor Author

TomAugspurger commented Jan 16, 2018

There sure are a lot of people importing from pandas.core.categorical :/ https://github.com/search?q=from+pandas.core.categorical+import&type=Code&utf8=%E2%9C%93

I think I'll add a small future warning saying to use the public API.

Edit: oh A good chunk of that is people just uploading their entire site-packages to github :/

@jreback
Copy link
Contributor

jreback commented Jan 16, 2018

you could add a deprecating module (e.g. like tslib.py) in the to-level to make a nice transition

@jbrockmendel
Copy link
Member

This looks pretty benign to me (I'm assuming there weren't any clandestine changes in the cut/paste).

I'd argue for calling it vectors instead of arrays so as to a) draw a clear distinction between the responsibilities of these objects vs np.array vs pd2 WIP and b) emphasize "FooVector is a vectorized version of FooScalar" (admittedly a motivation more specific to the arith/comparisons I've been focused on)

@jreback
Copy link
Contributor

jreback commented Jan 16, 2018

you prob need to change the paths in api.rst as well

@jreback
Copy link
Contributor

jreback commented Jan 16, 2018

I'd argue for calling it vectors instead of arrays so as to a) draw a clear distinction between the responsibilities of these objects vs np.array vs pd2 WIP and b) emphasize "FooVector is a vectorized version of FooScalar" (admittedly a motivation more specific to the arith/comparisons I've been focused on)

no this is naming scheme is well-established

@TomAugspurger
Copy link
Contributor Author

api.rst is all good. All the references via the public API.

@codecov
Copy link

codecov bot commented Jan 17, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@4086e42). Click here to learn what that means.
The diff coverage is 95.91%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #19269   +/-   ##
=========================================
  Coverage          ?    91.5%           
=========================================
  Files             ?      150           
  Lines             ?    48879           
  Branches          ?        0           
=========================================
  Hits              ?    44729           
  Misses            ?     4150           
  Partials          ?        0
Flag Coverage Δ
#multiple 89.88% <95.91%> (?)
#single 41.7% <39.52%> (?)
Impacted Files Coverage Δ
pandas/compat/pickle_compat.py 75.6% <ø> (ø)
pandas/io/pytables.py 92.45% <100%> (ø)
pandas/core/reshape/concat.py 97.58% <100%> (ø)
pandas/core/reshape/reshape.py 100% <100%> (ø)
pandas/core/indexes/multi.py 96.22% <100%> (ø)
pandas/core/arrays/__init__.py 100% <100%> (ø)
pandas/core/sorting.py 98.19% <100%> (ø)
pandas/core/series.py 94.61% <100%> (ø)
pandas/core/frame.py 97.62% <100%> (ø)
pandas/core/internals.py 94.5% <100%> (ø)
... and 8 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 4086e42...70da106. Read the comment docs.

@jreback
Copy link
Contributor

jreback commented Jan 18, 2018

not sure if you saw my comment above. I think you need a dummpy pandas.core.categorical.py which shows a FutureWarning.

@TomAugspurger
Copy link
Contributor Author

Yeah I have one. The diff is strange. The warning is at the top, and the import is at the bottom.

@jreback
Copy link
Contributor

jreback commented Jan 18, 2018

I c, ok. can you add a test for this (maybe in test_api), and add to the deprecations list. otherwise lgtm.

@TomAugspurger TomAugspurger force-pushed the pandas-array-interface-4 branch from c214234 to 6fd24d8 Compare January 18, 2018 02:14
@TomAugspurger
Copy link
Contributor Author

Added a test.

Moved pandas.core.categorical to arrays.
@TomAugspurger TomAugspurger force-pushed the pandas-array-interface-4 branch from 6fd24d8 to 70da106 Compare January 18, 2018 11:54
@TomAugspurger
Copy link
Contributor Author

Are we cool with merging PRs before the Mac build finishes? Travis had another outage, so they're backlogged again.

@TomAugspurger
Copy link
Contributor Author

I think I'm going to merge PRs that are unlikely to have issues specific to the Mac build. https://travis-ci.org/pandas-dev/pandas/builds/330306709 started 2.5 hours ago, and the Mac build hasn't been scheduled yet.

I'll do cleanup if I do break anything :)

@TomAugspurger TomAugspurger merged commit ca2d261 into pandas-dev:master Jan 18, 2018
@TomAugspurger TomAugspurger deleted the pandas-array-interface-4 branch January 18, 2018 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Categorical Categorical Data Type Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants