Skip to content

Collect Index methods by purpose: rendering, constructors, setops... #23961

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
Nov 28, 2018

Conversation

jbrockmendel
Copy link
Member

Zero changes to the contents of any methods, just collecting them in reasonably-scoped sections.

@pep8speaks
Copy link

Hello @jbrockmendel! Thanks for submitting the PR.

@jbrockmendel
Copy link
Member Author

travis failure appears unrelated

@codecov
Copy link

codecov bot commented Nov 28, 2018

Codecov Report

Merging #23961 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #23961      +/-   ##
==========================================
+ Coverage   92.31%   92.31%   +<.01%     
==========================================
  Files         161      161              
  Lines       51471    51473       +2     
==========================================
+ Hits        47515    47517       +2     
  Misses       3956     3956
Flag Coverage Δ
#multiple 90.7% <100%> (ø) ⬆️
#single 42.43% <49.76%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/indexes/category.py 97.87% <ø> (ø) ⬆️
pandas/core/indexes/base.py 96.48% <ø> (ø) ⬆️
pandas/core/indexes/range.py 97.32% <ø> (ø) ⬆️
pandas/core/indexes/multi.py 95.49% <100%> (ø) ⬆️
pandas/core/indexes/period.py 93.07% <100%> (ø) ⬆️
pandas/core/indexes/datetimelike.py 97.74% <100%> (ø) ⬆️
pandas/core/indexes/interval.py 94.69% <100%> (ø) ⬆️
pandas/core/indexes/timedeltas.py 89.18% <100%> (ø) ⬆️
pandas/core/indexes/datetimes.py 96.47% <100%> (ø) ⬆️
... and 1 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 6b4b956...a70b319. Read the comment docs.

nd_state, own_state = state
data = np.empty(nd_state[1], dtype=nd_state[2])
np.ndarray.__setstate__(data, nd_state)
self.name = own_state[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

indexing methods

Copy link
Member Author

Choose a reason for hiding this comment

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

what method was this comment supposed to refer to?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh this section, basically group all of the indexing (and indexer conversion methods)

Copy link
Contributor

Choose a reason for hiding this comment

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

IOW also include __getitem__

Copy link
Member Author

Choose a reason for hiding this comment

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

Not asking what section, asking what method. On GH your comment is pointing towards __setstate__, which I really doubt you mean should go in the indexing section


See Also
--------
numpy.ndarray.putmask
Copy link
Contributor

Choose a reason for hiding this comment

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

reshaping methods

Copy link
Member Author

Choose a reason for hiding this comment

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

what method was this comment supposed to refer to?

Copy link
Contributor

Choose a reason for hiding this comment

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

append/concat section

Copy link
Member Author

Choose a reason for hiding this comment

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

Same, asking what method, not what section

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.

generally ok, some comments. ideally put the same sections in the subclasses, even if they are empty (could be followup if needed)

nd_state, own_state = state
data = np.empty(nd_state[1], dtype=nd_state[2])
np.ndarray.__setstate__(data, nd_state)
self.name = own_state[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

oh this section, basically group all of the indexing (and indexer conversion methods)

.. versionadded:: 0.19.0
"""

@Appender(_index_shared_docs['astype'])
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe this goes in conversion

Copy link
Member Author

Choose a reason for hiding this comment

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

I considered that, thought that ndarray-like methods should take priority

"""
return value

def _assert_can_do_op(self, value):
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe to the Array section?

Copy link
Member Author

Choose a reason for hiding this comment

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

this is only actually used for fillna, so maybe in the null-handling section? its a weird fit


@cache_readonly
def is_unique(self):
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe consider these 2 introspection to the unique section

nd_state, own_state = state
data = np.empty(nd_state[1], dtype=nd_state[2])
np.ndarray.__setstate__(data, nd_state)
self.name = own_state[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

IOW also include __getitem__


See Also
--------
numpy.ndarray.putmask
Copy link
Contributor

Choose a reason for hiding this comment

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

append/concat section

@jreback jreback added the Clean label Nov 28, 2018
@jbrockmendel
Copy link
Member Author

collected uncategorized methods in one block just above generated-methods. implemented the subset of suggestions that didn't need clarification.

This is liable to become a rebasing nightmare if left open. I think should be multi-pass process.

@jreback jreback merged commit 30c1290 into pandas-dev:master Nov 28, 2018
@jreback
Copy link
Contributor

jreback commented Nov 28, 2018

thanks. if any comments you didn't address here, pls do in a followup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants