use astype(np.int64)

s = pd.Series(['', 8.00735e+09, 4.35789e+09, 6.10644e+09])
mask = pd.to_numeric(s).notnull()
s.loc[mask] = s.loc[mask].astype(np.int64)
s

0              
1    8007350000
2    4357890000
3    6106440000
dtype: object
Answer from piRSquared on Stack Overflow
Discussions

Python Pandas Dataframe Remove Float Trailing Zeros - Stack Overflow
I have a Pandas dataframe that I'm outputting to csv. I would like to keep the data types (i.e. not convert everything to string). I need to format the date properly and there are other non-float c... More on stackoverflow.com
๐ŸŒ stackoverflow.com
How to terminate or remove the .0 point from an int.
Try using the g flag when you print it. x = 5.0 y = 5.1 print("regular print:", x, y) print("with g flag:", f"{x:g} {y:g}") More on reddit.com
๐ŸŒ r/learnpython
5
2
December 9, 2022
floating point - How can I remove ".0" of float numbers? - Stack Overflow
Say I have a float number. If it is an integer (e.g. 1.0, 9.0, 36.0), I want to remove the ".0 (the decimal point and zero)" and write to stdout. For example, the result will be 1, 9, 36. If the fl... More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - How to remove unwanted `.0` s in pandas? - Stack Overflow
How can I avoid this unwanted .0? [this has been an annoying thing for the entire day yesterday...] ... You seem to be confusing objects with their representations. This DataFrame holds floats. You can represent these how you like (as strings) but when you change display options the objects remain the same. Converting to a list sends these float objects into a python ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
April 25, 2018
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 74966965 โ€บ how-can-i-remove-the-0-after-floats-in-a-dataframe-without-changing-the-object
python - How can I remove the .0 after floats in a DataFrame without changing the object type? (I have NANs and require numerical sorting) - Stack Overflow
Would pd.set_option('precision', 0) work for you? See also this question: stackoverflow.com/questions/37084812/โ€ฆ ... import pandas as pd mydict = {"part1":[1,2,None,4,5], "part2":[6,7,None,9,10]} df = pd.DataFrame(mydict) df['part2'] = df['part2'].astype('Int64') print(df)
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 74018909 โ€บ python-pandas-dataframe-remove-float-trailing-zeros
Python Pandas Dataframe Remove Float Trailing Zeros - Stack Overflow
I have a Pandas dataframe that I'm outputting to csv. I would like to keep the data types (i.e. not convert everything to string). I need to format the date properly and there are other non-float c...
๐ŸŒ
AskPython
askpython.com โ€บ home โ€บ how to format floats without trailing zeros?
How to Format Floats Without Trailing Zeros? - AskPython
May 12, 2023 - Python offers four effective methods to remove trailing zeros from float values: the to_integral() and normalize() functions, the str() and rstrip() functions, a while loop, and the float() function.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ how to terminate or remove the .0 point from an int.
r/learnpython on Reddit: How to terminate or remove the .0 point from an int.
December 9, 2022 -

Hello everyone,

I am still new to python and learning.

So I practiced some exercises and made an app that calculates the percentage from the number the user enters.

My question use, how can I terminate the .0 part if the user enters an Int and keep the decimal part if they enter a float?

so for example, 5% of 100 is 5 ( Int)

and 5.1% of 100 is 5.1 (float)

๐ŸŒ
Python Forum
python-forum.io โ€บ thread-29708.html
Dataframe Removes Zeros
September 16, 2020 - Hello all; I am importing an excel sheet into python as a dataframe using the code:- Report = pandas.read_excel(Crack_Report, sheet_name='Current', usecols=('A:BA'), skiprows=(4))In this excel sheet i have a set of columns with the following values...
Find elsewhere
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ how to eliminate trailing zeros?
r/learnpython on Reddit: How to eliminate trailing zeros?
February 12, 2020 -

I have a float formatted to 2 decimal places. I need to eliminate the 2nd decimal place if it's a "0" but still keep 2 decimal places open for when its 2 whole numbers.

number = float(25.20458)
    print(format(number, ".2f"))
#Comes out as 25.20
#Need 25.2

Windows 10 and Python 3.7

๐ŸŒ
Sopython
sopython.com โ€บ canon โ€บ 10 โ€บ formatting-a-float-to-remove-superfluous-zeros
Formatting a float to remove superfluous zeros - sopython
3 -> "3" 3. -> "3" 3.0 -> "3" 3.1 -> "3.1" 3.14 -> "3.14" 3.140 -> "3.14" Formatting floats in Python without superfluous zeros
๐ŸŒ
Python Guides
pythonguides.com โ€บ remove-the-trailing-zeros-from-a-decimal-in-python
Remove Trailing Zeros from Decimal in Python
September 3, 2025 - We used str() to convert the variable to a string and then used the .rstrip(0), which stands for the right strip and removes the specified 0 argument from the end of the string. Python provides this simple technique to remove trailing zeros from decimals using the float() function.
๐ŸŒ
Python Help
pythonhelp.org โ€บ tutorials โ€บ get-rid-of-0
How to get rid of that pesky .0 in Python
The round() function in Python can be used to round off a float value to a specified number of decimal places. We can use this function to remove the โ€œ.0โ€ from a float value by rounding it to zero decimal places.
๐ŸŒ
Medium
mike-diaz006.medium.com โ€บ what-i-learned-at-work-this-week-pandas-asserts-floats-63fe9a57500e
What I Learned at Work this Week: pandas Asserts Floats | by Mike Diaz | Medium
August 14, 2022 - If we cast the type from float to str, we can use replace to pull out the .0. In this simple example, this works! ... Rather than converting data back to what it was before the unexpected behavior, we might want to try preventing that behavior ...
๐ŸŒ
Bobby Hadz
bobbyhadz.com โ€บ blog โ€บ python-remove-trailing-zeros-from-decimal
How to Remove the trailing Zeros from a Decimal in Python | bobbyhadz
Copied!from decimal import Decimal num = Decimal('1.230000') string = str(num) without_trailing_zeros = string.rstrip( '0').rstrip('.') if '.' in string else string result = Decimal(without_trailing_zeros) print(result) # ๐Ÿ‘‰๏ธ 1.23
๐ŸŒ
Kodeclik
kodeclik.com โ€บ remove-trailing-zeros-in-python-string
How to remove Trailing Zeros from a given Python String
July 15, 2025 - The built-in float() function converts a string to a float and str() converts a float (or an integer) to a string. Implicitly float() helps remove trailing zeros.