In [16]: df = DataFrame(np.arange(10).reshape(5,2),columns=list('AB'))

In [17]: df
Out[17]: 
   A  B
0  0  1
1  2  3
2  4  5
3  6  7
4  8  9

In [18]: df.dtypes
Out[18]: 
A    int64
B    int64
dtype: object

Convert a series

In [19]: df['A'].apply(str)
Out[19]: 
0    0
1    2
2    4
3    6
4    8
Name: A, dtype: object

In [20]: df['A'].apply(str)[0]
Out[20]: '0'

Don't forget to assign the result back:

df['A'] = df['A'].apply(str)

Convert the whole frame

In [21]: df.applymap(str)
Out[21]: 
   A  B
0  0  1
1  2  3
2  4  5
3  6  7
4  8  9

In [22]: df.applymap(str).iloc[0,0]
Out[22]: '0'

df = df.applymap(str)
Answer from Jeff on Stack Overflow
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ pandas โ€บ pandas convert integer to string in dataframe
Pandas Convert Integer to String in DataFrame - Spark By {Examples}
December 5, 2024 - The .astype(str) method is applied to the 'Fee' column to convert all integer values in this column to strings. The printed DataFrame shows the updated 'Fee' column with string values, and the data types are displayed to confirm the change.
๐ŸŒ
Pandas
pandas.pydata.org โ€บ docs โ€บ reference โ€บ api โ€บ pandas.DataFrame.to_string.html
pandas.DataFrame.to_string โ€” pandas 3.0.1 documentation
Render a DataFrame to a console-friendly tabular output. ... Buffer to write to. If None, the output is returned as a string. ... The subset of columns to write. Writes all columns by default. ... The minimum width of each column. If a list of ints is given every integers corresponds with one column.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ fastest-way-to-convert-integers-to-strings-in-pandas-dataframe
Fastest way to Convert Integers to Strings in Pandas DataFrame
In the below example, we create ... pd.DataFrame({'int_column': [1, 2, 3, 4, 5]}) # define a lambda function to convert integers to strings int_to_str = lambda x: str(x) # apply the lambda function to the integer column df['int_column'] = df['int_column'].apply(int_to_str) # ...
๐ŸŒ
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() ...
Top answer
1 of 3
123

You need add parameter errors='coerce' to function to_numeric:

CopyID = pd.to_numeric(ID, errors='coerce')

If ID is column:

Copydf.ID = pd.to_numeric(df.ID, errors='coerce')

but non numeric are converted to NaN, so all values are float.

For int need convert NaN to some value e.g. 0 and then cast to int:

Copydf.ID = pd.to_numeric(df.ID, errors='coerce').fillna(0).astype(np.int64)

Sample:

Copydf = pd.DataFrame({'ID':['4806105017087','4806105017087','CN414149']})
print (df)
              ID
0  4806105017087
1  4806105017087
2       CN414149

print (pd.to_numeric(df.ID, errors='coerce'))
0    4.806105e+12
1    4.806105e+12
2             NaN
Name: ID, dtype: float64

df.ID = pd.to_numeric(df.ID, errors='coerce').fillna(0).astype(np.int64)
print (df)
              ID
0  4806105017087
1  4806105017087
2              0

EDIT: If use pandas 0.25+ then is possible use integer_na:

Copydf.ID = pd.to_numeric(df.ID, errors='coerce').astype('Int64')
print (df)
              ID
0  4806105017087
1  4806105017087
2            NaN
2 of 3
10
  1. If you're here because you got
OverflowError: Python int too large to convert to C long

use .astype('int64') for 64-bit signed integers:

Copydf['ID'] = df['ID'].astype('int64')

If you don't want to lose the values with letters in them, use str.replace() with a regex pattern to remove the non-digit characters.

Copydf['ID'] = df['ID'].str.replace('[^0-9]', '', regex=True).astype('int64')

Then input

0    4806105017087
1    4806105017087
2         CN414149
Name: ID, dtype: object

converts into

0    4806105017087
1    4806105017087
2           414149
Name: ID, dtype: int64
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ fastest-way-to-convert-integers-to-strings-in-pandas-dataframe
Fastest way to Convert Integers to Strings in Pandas DataFrame | GeeksforGeeks
August 1, 2020 - Converting DataFrame columns to ... in a Pandas DataFrameConvert DataFrame Column to Integer - using astype() Methodastype() method is simple...
๐ŸŒ
Python Forum
python-forum.io โ€บ Thread-pandas-convert-Int-to-str
[pandas] convert Int to str
Hi everyone, How do I convert an int to a string in Pandas? data['Hs_code'] = data.Hs_code.astype(str)this is my current attempt, any help is appreciated. Thanks
Find elsewhere
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ pandas โ€บ pandas convert column to string type
Pandas Convert Column to String Type - Spark By {Examples}
July 3, 2025 - Use pandas DataFrame.astype() function to convert a column from int to string, you can apply this on a specific column or on an entire DataFrame.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ how-to-convert-string-to-integer-in-pandas-dataframe
How to Convert String to Integer in Pandas DataFrame? - GeeksforGeeks
February 16, 2022 - In this article, we'll look at different methods to convert an integer into a string in a Pandas dataframe.
๐ŸŒ
Pandas
pandas.pydata.org โ€บ docs โ€บ reference โ€บ api โ€บ pandas.DataFrame.convert_dtypes.html
pandas.DataFrame.convert_dtypes โ€” pandas 3.0.1 documentation
Convert the DataFrame to use best possible dtypes. >>> dfn = df.convert_dtypes() >>> dfn a b c d e f 0 1 x True h 10 <NA> 1 2 y False i <NA> 100.5 2 3 z <NA> <NA> 20 200.0 ยท >>> dfn.dtypes a Int32 b string c boolean d string e Int64 f Float64 dtype: object
๐ŸŒ
Statology
statology.org โ€บ home โ€บ how to convert integer to string in pyspark (with example)
How to Convert Integer to String in PySpark (With Example)
October 11, 2023 - We can use the following syntax to display the data type of each column in the DataFrame: #check data type of each column df.dtypes [('team', 'string'), ('points', 'bigint')] We can see that the points column currently has a data type of integer. To convert this column from an integer to a string, we can use the following syntax:
๐ŸŒ
sqlpey
sqlpey.com โ€บ python โ€บ top-6-ways-to-convert-column-in-pandas-dataframe-from-int-to-string
Top 6 Ways to Convert a Column in a Pandas DataFrame from Integer to String
November 6, 2024 - You can also convert the integers to strings with the apply() function, which applies a given function to each element in a Series. ... For scenarios where you want to maintain the column as a string type while preserving NaN values, use:
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ pandas โ€บ pandas convert column to int in dataframe
Pandas Convert Column to Int in DataFrame - Spark By {Examples}
June 26, 2025 - Related: In Pandas, you can also convert column to string type. Below are quick examples of converting the column to integer dtype in DataFrame.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ pandas โ€บ how-to-convert-pandas-columns-to-string
How to Convert Pandas Columns to String - GeeksforGeeks
July 23, 2025 - import pandas as pd import numpy as np # Create a DataFrame with random numerical and string columns np.random.seed(42) data = { 'Numeric_Column': np.random.randint(1, 100, 4), 'String_Column': np.random.choice(['A', 'B', 'C', 'D'], 4) } df = pd.DataFrame(data) # Convert 'Numeric_Column' to string using astype() df['Numeric_Column'] = df['Numeric_Column'].astype(str) # Display the result print("Pandas DataFrame:") display(df) ... This method successfully converts the Numeric_Column from an integer type to a string.