Answers for "pandas add thousands separator"

0

pandas add thousands separator

# add thousand separator for integers and 2 decimal places for floats
df['count'] = df['count'].apply(lambda x: "{:,}".format(int(x)) if x == int(x) else "{:.2f}%".format(100*x))
Posted by: Guest on March-03-2022

Code answers related to "pandas add thousands separator"

Python Answers by Framework

Browse Popular Code Answers by Language