-
-
Notifications
You must be signed in to change notification settings - Fork 17.4k
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: when accessed from inside a column-wise df.apply(..., axis=1)
, row.index refers to df.columns, and row.name refers to df.index value
#30191
Comments
The docs currently read
Do you have a suggestion on how to word it more clearly? |
@simonjayhawkins - should the doc be reworded somehow, or is it alright as it is? (IMO it's clear already, it even includes examples for both EDITclosing for now, feel free to reopen if you have any suggestions :) |
I propose the following, you might be able to edit it to be somewhat more terse. But I think we do need to explicitly spell out the counterintuitive behavior of a row-wise apply (it took me ages to debug what was going on, and why my parent dataframe's index had disappeared within the apply):
(I didn't look into the case with multi-index.). |
@smcinerney jot opposed to a small update in the doc string but adding examples might be more useful |
@smcinerney feel free to submit a pull request |
Guys can we please go with just this doc change? I think it's a big enough improvement. Don't need code examples IMO. (I'm aware of multiple other cases in pandas doc where code examples are badly needed, and this one ain't it.) |
@smcinerney want to make a PR for this? |
DOC BUG: clarification for the function/lambda called inside apply()
When accessed from inside a column-wise
df.apply(lambda row:..., axis=1)
, things get counterintuitive:Code Sample, a copy-pastable example if possible
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.7.3.final.0
python-bits: 64
OS: Darwin
OS-release: 18.7.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.24.2
The text was updated successfully, but these errors were encountered: