-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Open
Labels
Closing CandidateMay be closeable, needs more eyeballsMay be closeable, needs more eyeballsEnhancementStringsString extension data type and string dataString extension data type and string data
Description
Feature Type
-
Adding new functionality to pandas
-
Changing existing functionality in pandas
-
Removing existing functionality in pandas
Problem Description
Many times I wanted to convert a float column into percentage but it's very verbose. Adding a str.format
method would make it easy to convert any numeric columns to percentage and also allow for many other use cases.
Feature Description
# Series.str class
def format(self, format_spec: str):
return self.apply(lambda x: format_spec.format(x))
series.str.format("{:%}")
Alternative Solutions
series.apply(lambda x: "{:%}".format(x))
Additional Context
There's many alternatives for creating formatted strings, but this feature should add the possibility to store the formatted values in pd.Series
instead.
I can submit a PR if this idea makes sense.
Metadata
Metadata
Assignees
Labels
Closing CandidateMay be closeable, needs more eyeballsMay be closeable, needs more eyeballsEnhancementStringsString extension data type and string dataString extension data type and string data