Created
July 6, 2022 13:39
-
-
Save ricgu8086/653e810f4aca1da3d09e0c3036c9383f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From https://stackoverflow.com/questions/23586510/return-multiple-columns-from-pandas-apply | |
def sizes(s): | |
return locale.format("%.1f", s / 1024.0, grouping=True) + ' KB', \ | |
locale.format("%.1f", s / 1024.0 ** 2, grouping=True) + ' MB', \ | |
locale.format("%.1f", s / 1024.0 ** 3, grouping=True) + ' GB' | |
df_test['size_kb'], df_test['size_mb'], df_test['size_gb'] = zip(*df_test['size'].apply(sizes)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment