Skip to content

DOC: Updated the docstring of pandas.Series.str.get #20630

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
wants to merge 1 commit into from
Closed

DOC: Updated the docstring of pandas.Series.str.get #20630

wants to merge 1 commit into from

Conversation

pranavsuri
Copy link
Contributor

@pranavsuri pranavsuri commented Apr 7, 2018

Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):

  • PR title is "DOC: update the docstring"
  • The validation script passes: scripts/validate_docstrings.py <your-function-or-method>
  • The PEP8 style check passes: git diff upstream/master -u -- "*.py" | flake8 --diff
  • The html version looks good: python doc/make.py --single <your-function-or-method>
  • It has been proofread on language by another sprint participant

Please include the output of the validation script below between the "```" ticks:

################################################################################
###################### Docstring (pandas.Series.str.get)  ######################
################################################################################

Extract element for each component.

Extract element from lists, tuples, or strings in each element in the
Series/Index.

Parameters
----------
i : int
    Integer index (location).

Returns
-------
items : Series/Index of objects

Examples
--------
>>> x = pd.Series(["String", (1, 2, 4), ["a", "b", "c"]])
>>> x
0       String
1    (1, 2, 4)
2    [a, b, c]
dtype: object

>>> x.str.get(1)
0      t
1      2
2      b
dtype: object

################################################################################
################################## Validation ##################################
################################################################################

Errors found:
	See Also section not found

@codecov
Copy link

codecov bot commented Apr 7, 2018

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #20630      +/-   ##
==========================================
+ Coverage   91.82%   91.84%   +0.02%     
==========================================
  Files         153      153              
  Lines       49256    49256              
==========================================
+ Hits        45227    45241      +14     
+ Misses       4029     4015      -14
Flag Coverage Δ
#multiple 90.23% <ø> (+0.02%) ⬆️
#single 41.9% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/strings.py 98.32% <ø> (ø) ⬆️
pandas/util/testing.py 84.73% <0%> (+0.2%) ⬆️
pandas/plotting/_converter.py 66.81% <0%> (+1.73%) ⬆️

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 6d610a4...ed71d52. Read the comment docs.


Examples
--------
>>> x = pd.Series(["String", (1, 2, 4), ["a", "b", "c"]])
Copy link
Member

Choose a reason for hiding this comment

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

The standard way is to name the Series s and not x.

0 String
1 (1, 2, 4)
2 [a, b, c]
dtype: object
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 add a numerical value, to show what happens.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since get is a method for strings, I didn't add a numerical value (using one returns 'NaN'). However, it can be added it if you say.

0 t
1 2
2 b
dtype: object
Copy link
Member

Choose a reason for hiding this comment

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

May be a example with a negative value too?

Extract element from lists, tuples, or strings in each element in the
Series/Index.

Parameters
----------
i : int
Integer index (location)
Integer index (location).
Copy link
Member

Choose a reason for hiding this comment

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

I find this not very clear. May be something like "Position of the element to extract"?

@@ -1651,17 +1651,34 @@ def str_translate(arr, table, deletechars=None):

def str_get(arr, i):
"""
Extract element for each component.
Copy link
Member

Choose a reason for hiding this comment

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

That is not very clear. May be "Extract element from the specified position" or "Extract element from the specified position in a list or string" if not too long.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay. How about, "Extract element for each component from the specified position." or "Extract the element from the specified position for all elements in Series."; something along those lines?

@gfyoung gfyoung added the Docs label Apr 10, 2018
@pranavsuri pranavsuri changed the title DOC: updated the docstring of pandas.Series.str.get DOC: Updated the docstring of pandas.Series.str.get Apr 10, 2018
@pranavsuri
Copy link
Contributor Author

Hello! I accidentally deleted the original fork from which I had created this pull-request. I've generated a new request at – #20667 with the mentioned changes. I'm sorry for the trouble.

@pranavsuri pranavsuri closed this Apr 12, 2018
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