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
🌐
GitHub
github.com › protocolbuffers › protobuf › issues › 8520
MessageToDict converts uint64 to string in python · Issue #8520 · protocolbuffers/protobuf
April 21, 2021 - ... syntax = "proto3"; message transmitter { string xxx = 1; optional Units xxx = 2; TimestampWithOffset xxx = 3; TimestampWithOffset xxx = 4; uint32 xxx = 5; string xxx = 6; string xxx = 7; uint64 transmitter_ticks = 8; string xxx = 9; string xxx = 10; }
Author   chris-from-the-coast
🌐
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
🌐
Python documentation
docs.python.org › 3 › library › stdtypes.html
Built-in Types — Python 3.14.5 documentation
Some operations are supported by several object types; in particular, practically all objects can be compared for equality, tested for truth value, and converted to a string (with the repr() function or the slightly different str() function).
🌐
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() ...
🌐
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
🌐
GitHub
github.com › tensorflow › tensorflow › issues › 21192
Unimplemented cast int64 to string is not supported · Issue #21192 · tensorflow/tensorflow
July 27, 2018 - Unimplemented: Cast int64 to string is not supported [[Node: Cast = Cast[DstT=DT_STRING, SrcT=DT_INT64, _output_shapes=[[2]], _device="/job:localhost/replica:0/task:0/device:CPU:0"](ArgMax)]] ... Traceback (most recent call last): File ...
Author   aroraakshit
Find elsewhere
🌐
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
🌐
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.
🌐
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 › 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
🌐
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
🌐
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.
🌐
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.
🌐
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
🌐
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.