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

pandas.Series.multiply documentation examples correction #23069

Closed
rneubig opened this issue Oct 10, 2018 · 1 comment · Fixed by #25136
Closed

pandas.Series.multiply documentation examples correction #23069

rneubig opened this issue Oct 10, 2018 · 1 comment · Fixed by #25136
Labels
Milestone

Comments

@rneubig
Copy link

rneubig commented Oct 10, 2018

Code Sample, a copy-pastable example if possible

Series.multiply(other, level=None, fill_value=None, axis=0)

Multiplication of series and other, element-wise (binary operator mul).

...

Examples:

a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
a
a 1.0
b 1.0
c 1.0
d NaN
dtype: float64
b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
b
a 1.0
b NaN
d 1.0
e NaN
dtype: float64
a.add(b, fill_value=0)
a 2.0
b 1.0
c 1.0
d 1.0
e NaN
dtype: float64

# Your code here

Examples:

>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
>>> a
a    1.0
b    1.0
c    1.0
d    NaN
dtype: float64
>>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
>>> b
a    1.0
b    NaN
d    1.0
e    NaN
dtype: float64
>>> a.multiply(b, fill_value=0)
a    1.0
b    0.0
c    0.0
d    0.0
e    NaN
dtype: float64

Problem description

[Example in pandas.Series.multiply Examples demonstrates the wrong function (add). Update to show multiply function as suggested above.]

Note: We receive a lot of issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates!

Note: Many problems can be resolved by simply upgrading pandas to the latest version. Before submitting, please check if that solution works for you. If possible, you may want to check if master addresses this issue, but that is not necessary.

For documentation-related issues, you can check the latest versions of the docs on master here:

https://pandas-docs.github.io/pandas-docs-travis/

If the issue has not been resolved there, go ahead and file it in the issue tracker.

Expected Output

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]

@WillAyd WillAyd added the Docs label Oct 11, 2018
@WillAyd
Copy link
Member

WillAyd commented Oct 11, 2018

Makes sense - PRs are always welcome

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