Numeric columns have no ,, so converting to strings is not necessary, only use DataFrame.replace with regex=True for substrings replacement:

df = df.replace(',','', regex=True)

Or:

df.replace(',','', regex=True, inplace=True)

And last convert strings columns to numeric, thank you @anki_91:

c = df.select_dtypes(object).columns
df[c] = df[c].apply(pd.to_numeric,errors='coerce')
Answer from jezrael on Stack Overflow
🌐
Reddit
reddit.com › r/learnpython › removing number comma seperators in csv file
r/learnpython on Reddit: Removing number comma seperators in csv file
May 5, 2021 -

Hey guys, I have a csv file with any number greater than 999 being listed as a string in the form “1,000”. including the quotes. I’m trying to get rid of these commas so I can turn them into an integer, however I’m unsure how to do it without touching the other commas used to seperate the values. Any suggestions? So far I have thought this out but it’s not quite right.

‘’’ import pandas as pd df = pd.read_csv(‘..., sep = “, “)

firstline = True

if firstline: firstline = False else: for line in df: if “,” in line[3]: #the column with the values line[3].replace(“,”, “ “)

‘’’

Sorry for the formatting I am on phone. Thanks for the help :)

🌐
PyTutorial
pytutorial.com › remove-comma-in-number-python
PyTutorial | How to Remove Comma in Number Python
February 15, 2023 - In conclusion, you can use different methods to remove commas from a number in python, replace() or re.sub().
Find elsewhere
🌐
GitHub
github.com › streamlit › streamlit › issues › 8695
Commas can't be removed from numbers in st.dataframe · Issue #8695 · streamlit/streamlit
May 16, 2024 - Numbers are displayed in st.dataframe with commas and cannot be changed via ColumnConfig.
Author   streamlit
🌐
Medium
medium.com › the-innovation › basic-steps-when-cleaning-a-data-set-using-pandas-3576e716173d
Basic Steps When Cleaning a Data Set Using Pandas | by Will Newton | Medium
August 3, 2020 - In this instance, we want to remove the dollar sign and comma for all 5,782 rows in this dataframe. Let’s start with the dollar sign. We will start by defining a list in Python of the columns that we want to clean and then write a for loop that will iterate through all the rows we defined and remove the $ using the .replace() method.
🌐
Stack Overflow
stackoverflow.com › questions › 60736686 › how-to-delete-commas-in-whole-dataframe-using-pandas-or-python
how to delete commas in whole DataFrame using pandas or python - Stack Overflow
In the documentation, replace is a function that is applied to the dataframe, you might get errors if you do something like df = df.replace(). And the last idea is that the number formatting might be visual only. Can you not work with the data in there? A conversion might help you, but it might also not be an issue at all, if you simply want to work with data. Another idea would be converting them from numbers to strings, and replacing the commas with spaces, if needed be.
🌐
Mark Needham
markhneedham.com › blog › 2021 › 04 › 11 › pandas-format-dataframe-numbers-commas-decimals
Pandas - Format DataFrame numbers with commas and control decimal places | Mark Needham
April 11, 2021 - 204 """ --> 205 return self.render() 206 207 @doc( ~/.local/share/virtualenvs/covid-vaccines-xEbcGJTy/lib/python3.8/site-packages/pandas/io/formats/style.py in render(self, **kwargs) 619 self._compute() 620 # TODO: namespace all the pandas keys --> 621 d = self._translate() 622 # filter out empty styles, every cell will have a class 623 # but the list of props may just be [['', '']]. ~/.local/share/virtualenvs/covid-vaccines-xEbcGJTy/lib/python3.8/site-packages/pandas/io/formats/style.py in _translate(self) 403 "value": value, 404 "class": " ".join(cs), --> 405 "display_value": formatter(value
🌐
Saturn Cloud
saturncloud.io › blog › how-to-remove-characters-from-a-pandas-column-a-data-scientists-guide
How to Remove Characters from a Pandas Column A Data Scientists Guide | Saturn Cloud Blog
May 1, 2026 - As a data scientist one of the most common tasks youll encounter is cleaning and preprocessing data In particular you may need to remove certain characters from a pandas column to extract relevant information or convert the data into a more usable format In this article well cover the different ...
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › how to remove commas from a string python
How to Remove Commas from a String Python - Spark By {Examples}
November 7, 2024 - How to remove commas from a string in Python? To remove commas from a string you can use multiple approaches of Python. You can use some of the approaches
🌐
Kite
kite.com › python › answers › how-to-remove-a-comma-from-a-string-in-python
Kite is saying farewell - Code Faster with Kite
November 20, 2022 - P.S. Most of our code has been open sourced on Github here. It includes our data-driven Python type inference engine, Python public-package analyzer, desktop software, editor integrations, Github crawler and analyzer, and much more.
🌐
Programmersought
programmersought.com › article › 12114965839
Three methods for pandas to remove the comma in the thousands of numbers - Programmer Sought
In the daily data cleaning process, we frequently process some numbers, such as logs, or automatically generated reports. These places always have thousands of commas, which are significant for the subsequent calculation and storage of data. Impact, here will use three methods to teach you how to deal with the problem of thousands of commas super convenient · import pandas as pd a = [[['22,900', '7,100'], ['3,400', '-0.03'], [ '5', '0']]] df = pd.DataFrame(a) df