Skip to content

CLN: replacing str.format with f-strings in several files. #29547 #30612

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
Jan 3, 2020

Conversation

jlamborn324
Copy link
Contributor

@jlamborn324 jlamborn324 commented Jan 2, 2020

@charlesdong1991 charlesdong1991 added the Code Style Code style, linting, code_checks label Jan 2, 2020
Copy link
Member

@charlesdong1991 charlesdong1991 left a comment

Choose a reason for hiding this comment

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

very nice! one minor comment (not related to the issue though)

if x > 0
else "color: {z}".format(z=z)
)
g = lambda x, y, z: f"color: {z}" if x > 0 else f"color: {z}"
Copy link
Member

Choose a reason for hiding this comment

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

not related to the issue, maybe y can be removed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! I'll look into taking care of it

Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

Thanks @jlamborn324 for the PR. generally lgtm. a few minor suggestions

@simonjayhawkins simonjayhawkins added this to the 1.0 milestone Jan 2, 2020
@@ -711,7 +709,7 @@ def format_func(x):

def test_to_string_with_formatters_unicode(self):
df = DataFrame({"c/\u03c3": [1, 2, 3]})
result = df.to_string(formatters={"c/\u03c3": lambda x: "{x}".format(x=x)})
result = df.to_string(formatters={"c/\u03c3": lambda x: f"{x}"})
Copy link
Member

Choose a reason for hiding this comment

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

can this just be str(x)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. Thank you for your help!

Co-Authored-By: Simon Hawkins <simonjayhawkins@gmail.com>
Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

@datapythonista datapythonista merged commit a53545e into pandas-dev:master Jan 3, 2020
@datapythonista
Copy link
Member

Thanks for the clean up @jlamborn324

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.

5 participants