The type object is actually string in pandas dataframe.

If you would like to retain the data as string, use df.to_excel() instead of df.to_csv. This is because when opening the CSV file, Excel will automatically convert the number data to numbers.

df1 = pd.DataFrame({'GL': [2311000200.0, 2312000600.0, 2330800100.0]})
df1.GL = df1.GL.astype('int64').astype('string')
df1.to_excel('test.xlsx', index=False)

Answer from threadfin on Stack Overflow
🌐
GitHub
github.com › pandas-dev › pandas › issues › 57418
BUG: conversion from Int64 to string introduces decimals in Pandas 2.2.0 · Issue #57418 · pandas-dev/pandas
February 14, 2024 - I.e. 12 will be converted to "12.0". This bug got introduced in Pandas 2.2.0, is still present on Pandas 2.2.x branch, but is not present on Pandas main branch. import pandas as pd x = pd.Series([12, pd.NA], dtype="Int64[pyarrow]").astype("string[pyarrow]") assert x[0] == "12" ... commit : fd3f571 python : 3.11.7.final.0 python-bits : 64 OS : Darwin OS-release : 23.2.0 Version : Darwin Kernel Version 23.2.0: Wed Nov 15 21:59:33 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8112 machine : arm64 processor : arm byteorder : little LC_ALL : None LANG : None LOCALE : None.UTF-8
Author   mplatzer
Discussions

How to convert python int into numpy.int64? - Stack Overflow
Given a variable in python of type int, e.g. z = 50 type(z) ## outputs is there a straightforward way to convert this variable into numpy.int64? It appears one would have to More on stackoverflow.com
🌐 stackoverflow.com
Unimplemented cast int64 to string is not supported - tensorflow_model_server
System information OS Platform and Distribution: Linux Ubuntu 16.04.4 TensorFlow Serving installed from: binary TensorFlow Serving version: 1.8 Using virtual environment in python 3.5.2 Describe th... More on github.com
🌐 github.com
2
July 26, 2018
to_dict doesn't convert np.int64 to python integers
There was an error while loading. Please reload this page · depending on the count of output columns, numpy integers getting converted to python integers More on github.com
🌐 github.com
8
April 18, 2017
BUG: using dtype='int64' argument of Series causes `ValueError: values cannot be losslessly cast to int64` for integer strings
Pandas version checks I have checked that this issue has not already been reported. I have confirmed this bug exists on the latest version of pandas. I have confirmed this bug exists on the master ... More on github.com
🌐 github.com
2
December 16, 2021
🌐
GitHub
github.com › pandas-dev › pandas › issues › 29488
Cannot convert string to Int64 · Issue #29488 · pandas-dev/pandas
November 8, 2019 - Unlike with the other numeric data types, It doesn't seem to be possible to parse a string as Int64. A decent workaround seems to be converting first to float, but that's rather awkward.
Author   maresb
🌐
GitHub
github.com › tensorflow › serving › issues › 1017
Unimplemented cast int64 to string is not supported - tensorflow_model_server · Issue #1017 · tensorflow/serving
July 26, 2018 - System information OS Platform and Distribution: Linux Ubuntu 16.04.4 TensorFlow Serving installed from: binary TensorFlow Serving version: 1.8 Using virtual environment in python 3.5.2 Describe the problem After following the steps in U...
Author   aroraakshit
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-convert-integers-to-strings-in-pandas-dataframe
How to Convert Integers to Strings in Pandas DataFrame? - GeeksforGeeks
July 1, 2022 - In Python, a string can be converted into an integer using the following methods : Method 1: Using built-in int() function: If your string contains a decimal integer and you wish to convert it into an int, in that case, pass your string to int() ...
🌐
Librarycarpentry
librarycarpentry.github.io › library-python › 03-data-types-and-format
Python for Librarians: Data Types and Formats
August 1, 2018 - A type ‘O’ just stands for “object” which in Pandas’ world is a string (characters). ... The type int64 tells us that Python is storing each value within this column as a 64 bit integer. We can use the dat.dtypes command to view the data type for each column in a DataFrame (all at once).
🌐
GitHub
github.com › pandas-dev › pandas › issues › 16048
to_dict doesn't convert np.int64 to python integers · Issue #16048 · pandas-dev/pandas
April 18, 2017 - to_dict doesn't convert np.int64 to python integers#16048 · Copy link · Labels · Duplicate ReportDuplicate issue or pull requestDuplicate issue or pull request · kszucs · opened · on Apr 18, 2017 · Issue body actions ·
Author   kszucs
Find elsewhere
🌐
GitHub
github.com › pandas-dev › pandas › issues › 44923
BUG: using dtype='int64' argument of Series causes `ValueError: values cannot be losslessly cast to int64` for integer strings · Issue #44923 · pandas-dev/pandas
December 16, 2021 - BUG: using dtype='int64' argument of Series causes ValueError: values cannot be losslessly cast to int64 for integer strings#44923
Author   5j9
🌐
GitHub
github.com › danielgtaylor › python-betterproto › issues › 244
Different treatment for int32 and int64 types in .to_dict() and .from_dict() methods · Issue #244 · danielgtaylor/python-betterproto
May 26, 2021 - When converting a message to dict, int64 types are converted to strings, whereas int32 types are left as ints. Is this intended behaviour or a bug? It's not obvious to me why in a Python contex...
Published   May 26, 2021
Author   jonmather
🌐
Real Python
realpython.com › convert-python-string-to-int
How to Convert a Python String to int – Real Python
January 16, 2021 - There are several ways to represent integers in Python. In this quick and practical tutorial, you'll learn how you can store integers using int and str as well as how you can convert a Python string to an int and vice versa.
🌐
Python Data Science Handbook
jakevdp.github.io › PythonDataScienceHandbook › 02.01-understanding-data-types.html
Understanding Data Types in Python | Python Data Science Handbook
Notice the main difference: in C, the data types of each variable are explicitly declared, while in Python the types are dynamically inferred. This means, for example, that we can assign any kind of data to any variable: ... Here we've switched the contents of x from an integer to a string.
🌐
GitHub
github.com › protocolbuffers › protobuf › issues › 2679
Why uint64, int64 Protobuf-Type be serialize as String JSON-Type in MessageToJsonString()? · Issue #2679 · protocolbuffers/protobuf
February 7, 2017 - Why uint64, int64 Protobuf-Type be serialize as String JSON-Type in MessageToJsonString()? I tried to use uint64 or int64 to save the Timestamp, and convert it to JSON by MessageToJsonString() Here is a sample output: {"timestamp":"14864...
Author   david9991
🌐
GitHub
github.com › h5py › h5py › issues › 2456
With numpy 2 (and h5py 3.11) all integers get written as np.int64 and it breaks things. · Issue #2456 · h5py/h5py
July 10, 2024 - Reload to refresh your session. ... a = 1 with h5py.File('tmp.h5', 'w') as fl: fl.attrs['a'] = a with h5py.File('tmp.h5', 'r') as fl: new_a = fl.attrs['a'] Then new_a has type np.int64 rather than int. This is fine for some purposes, i.e. I can do a == new_a and it returns a truthy value (np.True_ now instead of True). However, the string representation of the values is different (1 vs.
Author   steven-murray
🌐
Medium
tmlb-blog-ltd.medium.com › to-convert-a-float64-type-column-into-an-int64-or-string-type-column-in-python-short-984537c97a63
To convert a float64-type column into an int64 or string-type column in python (short) | by T Miyamoto | Medium
August 20, 2020 - df_a['coli']= (df_a['colf'].apply(lambda w0: None if pd.isnull(w0) else np.int64(w0)) ).astype(pd.Int64Dtype()) ... Next we create a string type column based on column colf.
🌐
GeeksforGeeks
geeksforgeeks.org › convert-integer-to-string-in-python
Convert integer to string in Python - GeeksforGeeks
Explanation: str(n) converts n to a string, resulting in '42'. For Python 3.6 or later, f-strings provide a quick way to format and convert values.
Published   April 25, 2025
🌐
Unstop
unstop.com › home › blog › convert int to string in python (6 methods with examples)
Convert Int To String In Python (6 Methods With Examples)
April 11, 2024 - In this article, we will learn about how to convert int to string in Python language and various methods used for this purpose like str() function, string formatting, format() method, F-strings, positional formatting, __str__() method and chr() function with examples.
🌐
Career Karma
careerkarma.com › blog › python › python string to int() and int to string tutorial: type conversion in python
Python String to Int() and Int to String Tutorial: Type Conversion in Python
December 1, 2023 - Python includes built-in methods that can be used to perform these conversions: int() and str(). In this tutorial, we’ll explore how the int() method can be used to convert a string to an integer in Python.
🌐
SheCodes
shecodes.io › athena › 2142-converting-an-integer-to-string-in-python
[Python] - Converting an Integer to String in Python - | SheCodes
Learn how to convert an integer to a string in Python by using the `str()` function or casting the integer as a string.