-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
%s changed to fstring, single quotes in f string changed to double qu… #30108
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
Conversation
pandas/_libs/tslibs/period.pyx
Outdated
@@ -1209,8 +1209,7 @@ def period_format(int64_t value, int freq, object fmt=None): | |||
elif freq_group == 4000: # WK | |||
left = period_asfreq(value, freq, 6000, 0) | |||
right = period_asfreq(value, freq, 6000, 1) | |||
return '%s/%s' % (period_format(left, 6000), | |||
period_format(right, 6000)) | |||
return f"(period_format(left, 6000)/period_format(right, 6000))" |
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.
are we calling this function inside a loop? if so, we may need to be careful about whether cython fstrings differently from % formatting
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.
more generally, id prefer to have non-trivial function calls occur outside of f-space.
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 CI failures look related to this
#30094 can you submit updates on the same PR opposed to a new PR in the future |
pandas/_libs/tslibs/period.pyx
Outdated
@@ -1209,8 +1209,7 @@ def period_format(int64_t value, int freq, object fmt=None): | |||
elif freq_group == 4000: # WK | |||
left = period_asfreq(value, freq, 6000, 0) | |||
right = period_asfreq(value, freq, 6000, 1) | |||
return '%s/%s' % (period_format(left, 6000), | |||
period_format(right, 6000)) | |||
return f"(period_format(left, 6000)/period_format(right, 6000))" |
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.
return f"(period_format(left, 6000)/period_format(right, 6000))" | |
return f"{period_format(left, 6000}/{period_format(right, 6000}" |
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.
just pushed this change. it fixed the errors for locally
LGTM |
over to you @WillAyd |
Thanks @Behemkot and @jbrockmendel |
#29547 (comment)
#29547
changed %s to f strings and f ' ' to f " ".
str.format() remained unchanged due to:
#29547 (comment)