Skip to content

DOC: Refactor numeric index docs #14985

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

Closed

Conversation

gfyoung
Copy link
Member

@gfyoung gfyoung commented Dec 25, 2016

Refactor NumericIndex docs to avoid duplicate documentation. xref #14937.

@codecov-io
Copy link

codecov-io commented Dec 26, 2016

Current coverage is 84.78% (diff: 100%)

Merging #14985 into master will increase coverage by <.01%

@@             master     #14985   diff @@
==========================================
  Files           145        145          
  Lines         51090      51107    +17   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43315      43333    +18   
+ Misses         7775       7774     -1   
  Partials          0          0          

Powered by Codecov. Last update 7f0eefc...ba80766

@jreback jreback added Docs Indexing Related to indexing on series/frames, not to indexes themselves labels Dec 26, 2016
@jreback jreback added this to the 0.20.0 milestone Dec 26, 2016
@jreback
Copy link
Contributor

jreback commented Dec 26, 2016

nit: needs a blank like before Paramaters. need to wrap the line for Int64Index.


In [1]: pd.Int64Index?
Init signature: pd.Int64Index(data=None, dtype=None, copy=False, name=None, fastpath=False)
Docstring:     
Immutable ndarray implementing an ordered, sliceable set. The basic object
storing axis labels for all pandas objects. Int64Index is a special case
of `Index` with purely integer labels. This is the default index type used by the DataFrame and Series ctors when no explicit index is provided by the user.
Parameters
----------
data : array-like (1-dimensional)
dtype : NumPy dtype (default: int64)
copy : bool
    Make a copy of input ndarray
name : object
    Name to be stored in the index
Notes
-----
An Index instance can **only** contain hashable objects.
File:           ~/pandas/pandas/indexes/numeric.py
Type:           type

In [2]: pd.Float64Index?
Init signature: pd.Float64Index(data=None, dtype=None, copy=False, name=None, fastpath=False)
Docstring:     
Immutable ndarray implementing an ordered, sliceable set. The basic object
storing axis labels for all pandas objects. Float64Index is a special case
of `Index` with purely integer labels. 
Parameters
----------
data : array-like (1-dimensional)
dtype : NumPy dtype (default: float64)
copy : bool
    Make a copy of input ndarray
name : object
    Name to be stored in the index
Notes
-----
An Index instance can **only** contain hashable objects.
File:           ~/pandas/pandas/indexes/numeric.py
Type:           type

@gfyoung gfyoung force-pushed the numeric-doc-refactor branch from bb4a9ac to 26c5261 Compare December 26, 2016 21:21
@gfyoung
Copy link
Member Author

gfyoung commented Dec 27, 2016

@jreback : Made the requested doc changes. Ready to merge if there are no other concerns.

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

+1 on sharing docstrings for public functions (eg the classes in this PR), but I am not sure we should also do this for private helper functions.
As the docstrings there are in the first place helpful for developers when looking and trying to understand the code. That the docstring is right there next to the function when looking at it in your IDE can be very helpful.

convert a scalar indexer

_index_shared_docs['_convert_scalar_indexer'] = """
Convert a scalar indexer.
Parameters
Copy link
Member

Choose a reason for hiding this comment

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

also a blank line missing above 'Parameters' here I think

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. Done.

by the DataFrame and Series ctors when no explicit index is provided by the
user.
storing axis labels for all pandas objects. %(klass)s is a special case
of `Index` with purely integer labels. %(extra)s
Copy link
Member

Choose a reason for hiding this comment

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

"purely integer labels" -> will also be used for Float64Index?

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. Done.

@gfyoung
Copy link
Member Author

gfyoung commented Dec 27, 2016

@jorisvandenbossche : I think sharing docstrings across private functions is fine. I get more confused by the inconsistencies across written-out docstrings for the same functions, whether private or public. Not to mention, there are already numerous private functions in base.py that docstring-shared.

@gfyoung gfyoung force-pushed the numeric-doc-refactor branch from 26c5261 to ba80766 Compare December 27, 2016 19:27
@gfyoung
Copy link
Member Author

gfyoung commented Dec 30, 2016

@jreback , @jorisvandenbossche : If there are no other concerns, I think this is good to merge.

@jreback jreback closed this in 4a4635d Dec 30, 2016
@jreback
Copy link
Contributor

jreback commented Dec 30, 2016

thanks!

@gfyoung gfyoung deleted the numeric-doc-refactor branch December 30, 2016 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants