Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DOC: fixed doc-string for combine & combine_first in pandas/core/series.py #22971
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
DOC: fixed doc-string for combine & combine_first in pandas/core/series.py #22971
Changes from 14 commits
06e5af0
6d1dae6
63c6b4b
52955a3
bf123bd
de2a6e2
2ee7f4a
52c1911
c921539
c9a2490
0a00632
8c928f5
f6099da
edc1524
7390f46
8804436
ddd3e12
7902672
e35a038
02521e7
efd42ad
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation is wrong, should be indented 4 spaces respect to the previous line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you fix this please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this first example as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, @mroeschke
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say all those animals have 4 legs and 0 arms. Use correct data, and different values (spider, monkey...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this example look fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not find any alternative to defining a
lambda
, since the next alternative was to use+
itself, which cannot be done as a function param afaikThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the example not following pep8 again, you may not be able to use a sum without a
lambda
, but as I said, you can use the builtinmax
function.In the first example, remove completely the
fill_value
param, and in the second use a example that makes sense.Also, add a short description before each case, explaining what is the goal of what you're showing. pandas does not contain functions or methods that are not useful for real-world examples. And in the documentation examples we should show those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of combine() is to merge two Series into one.
So, I need 2 Series with some conflicting values[that use
func
to resolve conflict], and some NOT CONFLICTING ones[that could make use offill_value
to assume a value from the lacking Series]I will use
max
for an example I just thought!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks much better, yes. I'd name the Series
s1
ands2
following our standards, and also have the animal names in all lower case.And I don't quite understand the
fill_value
part. I guess I'm misunderstanding something, but if:I would expect that in the first example
duck
has a value ofnan
. And in that case I'd usefill_value=0
to get the known value. I don't quite lack making up an average speed. But I guess the function doesn't work as I think.Can you do a bit of research and move the examples to the PR, so I can add new comments in a review.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@datapythonista look! something funny!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@datapythonista
fill_value
is used as the default value for the missing key in the corresponding series before the comparison is made.So in the example above, since
data_B
doesn't haveDuck
, the comparison is made as ifdata_B['Duck'] = fill_value = 40
somax(data_B['Duck'], data_A['Duck']) = max(40, 30) = 40
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This answer on StackOverflow clears this doubt for me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@datapythonista please read this !