Formatting float column of Dataframe in Pandas Last Updated : 03 Oct, 2025 Comments Improve Suggest changes Like Article Like Report Float columns in Pandas often show long decimals or scientific notation. Formatting them by rounding, adding separators, or scaling improves readability while keeping the underlying data unchanged.This article covers simple ways to format floats in Pandas.1. Round Off Float ValuesYou can round float values to a fixed number of decimal places using pd.options.display.float_format. Python import pandas as pd data = {'Month': ['January', 'February', 'March', 'April'], 'Expense': [21525220.653, 31125840.875, 23135428.768, 56245263.942]} df = pd.DataFrame(data, columns=['Month', 'Expense']) pd.options.display.float_format = '{:.2f}'.format print(df) Output Month Expense 0 January 21525220.65 1 February 31125840.88 2 March 23135428.77 3 April 56245263.94 Explanation:pd.options.display.float_format: Sets the display format for floats in Pandas.'{:.2f}'.format: Rounds values to 2 decimal places in fixed-point notation.2. Format with Separators and Decimal PrecisionAdding commas as thousand separators and controlling decimal precision improves clarity. Python import pandas as pd data = {'Product': ['Laptop', 'Phone', 'Tablet', 'Desktop'], 'Price': [1200.50, 799.99, 349.75, 1500.25]} df = pd.DataFrame(data, columns=['Product', 'Price']) pd.options.display.float_format = '{:,.2f}'.format df['Price'] = df['Price'].apply(lambda x: '{:,.2f}'.format(x)) print(df) Output Product Price 0 Laptop 1,200.50 1 Phone 799.99 2 Tablet 349.75 3 Desktop 1,500.25 Explanation:'{:,.2f}'.format: Formats numbers with commas and 2 decimal places..apply(lambda x: ...): Applies the formatting to each element in the column.3. Scale and Format NumbersLarge numbers can be hard to interpret. Scaling values and applying formatting makes the data easier to read. Python import pandas as pd data = {'City': ['New York', 'Los Angeles', 'Chicago', 'Houston'], 'Population': [833687, 390400, 271000, 232800]} df = pd.DataFrame(data, columns=['City', 'Population']) df['Population'] = df['Population'] / 100000 pd.options.display.float_format = '{:,.2f}'.format print(df) Output City Population 0 New York 8.34 1 Los Angeles 3.90 2 Chicago 2.71 3 Houston 2.33 Explanation:Dividing by 1000000 scales numbers to millions.'{:,.2f}'.format rounds and adds separators.Related Articles:Formatting float column of Dataframe in PandasPandas Tutorial Comment More info A ankthon Follow Improve Article Tags : Technical Scripter Python Technical Scripter 2018 Python-pandas Python pandas-dataFrame pandas-dataframe-program +2 More Explore Python FundamentalsPython Introduction 2 min read Input and Output in Python 4 min read Python Variables 5 min read Python Operators 4 min read Python Keywords 2 min read Python Data Types 7 min read Conditional Statements in Python 3 min read Loops in Python - For, While and Nested Loops 5 min read Python Functions 5 min read Recursion in Python 4 min read Python Lambda Functions 5 min read Python Data StructuresPython String 5 min read Python Lists 4 min read Python Tuples 4 min read Python Dictionary 3 min read Python Sets 6 min read Python Arrays 7 min read List Comprehension in Python 4 min read Advanced PythonPython OOP Concepts 11 min read Python Exception Handling 5 min read File Handling in Python 4 min read Python Database Tutorial 4 min read Python MongoDB Tutorial 2 min read Python MySQL 9 min read Python Packages 12 min read Python Modules 7 min read Python DSA Libraries 15 min read List of Python GUI Library and Packages 3 min read Data Science with PythonNumPy Tutorial - Python Library 3 min read Pandas Tutorial 6 min read Matplotlib Tutorial 5 min read Python Seaborn Tutorial 15+ min read StatsModel Library- Tutorial 4 min read Learning Model Building in Scikit-learn 8 min read TensorFlow Tutorial 2 min read PyTorch Tutorial 6 min read Web Development with PythonFlask Tutorial 8 min read Django Tutorial | Learn Django Framework 7 min read Django ORM - Inserting, Updating & Deleting Data 4 min read Templating With Jinja2 in Flask 6 min read Django Templates 7 min read Python | Build a REST API using Flask 3 min read How to Create a basic API using Django Rest Framework ? 4 min read Python PracticePython Quiz 3 min read Python Coding Practice 1 min read Python Interview Questions and Answers (2025) 3 min read Like