Skip to content

CLN: GH29547 format with f-strings #34502

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

Merged
merged 8 commits into from
Jun 20, 2020
Merged

Conversation

DanBasson
Copy link
Contributor

replace .format() for f-strings in the following:

  1. pandas/tests/series/indexing/test_numeric.py
  2. pandas/tests/series/indexing/test_take.py
  3. pandas/tests/series/indexing/test_where.py

@pep8speaks
Copy link

pep8speaks commented May 31, 2020

Hello @DanBasson! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-06-20 16:23:55 UTC

"cannot do slice indexing on DatetimeIndex with these indexers "
r"\[{key}\] of type float"
msg = lambda key: (
f"cannot do slice indexing on DatetimeIndex with these indexers "
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 remove the f here and run black to get linting green? I would wait for one of the core devs to give an opinion but usually def is preferred to a named lambda.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you for your response.

if i remove the f in the f-string the code doesn't compile.
may i ask why def is preferred for this? i think that lambda suits better because it's a short statement.
also, i published my solution in the thread but didn't get any response

Copy link
Member

Choose a reason for hiding this comment

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

Using def vs. lambda is partly a stylistic thing, with the idea being that lambdas are intended as anonymous functions, so naming them somewhat misses the point.

Did you remove the f from all strings? You only need to remove it from the strings for which it has no effect, i.e., when there is nothing to evaluate (e.g., line 87).

@jreback jreback added the Code Style Code style, linting, code_checks label Jun 20, 2020
@jreback jreback added this to the 1.1 milestone Jun 20, 2020
@jreback
Copy link
Contributor

jreback commented Jun 20, 2020

lgtm. ping on green (the 3.9 biuld is failing but x that)

@DanBasson
Copy link
Contributor Author

i don't understand what you are saying (i'm new...).
what is "ping on green"?

@jreback
Copy link
Contributor

jreback commented Jun 20, 2020

i don't understand what you are saying (i'm new...).
what is "ping on green"?

it means when the CI are all green, comment. note that the CI is currently having various issues.

@DanBasson
Copy link
Contributor Author

@jreback

the CI are all green.
i got some errors which i couldn't understand

@jreback
Copy link
Contributor

jreback commented Jun 20, 2020

just to make sure (this error should be patched), can you merge upstream master and then ping on green.

@DanBasson
Copy link
Contributor Author

Turns out that was the problem.
thank you very much @jreback

@jreback jreback merged commit 5a4fe4f into pandas-dev:master Jun 20, 2020
@jreback
Copy link
Contributor

jreback commented Jun 20, 2020

thanks @DanBasson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants