You can use

df['MPRN'] = pd.to_numeric(df['MPRN'], errors="coerce").fillna(0).astype('int64')
Answer from Mizanur Choudhury on Stack Overflow
Discussions

pandas converts int32 to int64
There was an error while loading. Please reload this page · Is this intended? I had hoped no copying at all would happen in that case More on github.com
🌐 github.com
14
January 13, 2012
Discover Python int as int32 instead of int64
Should we default to int32 for basic Python ints? This is more compatible with DyND and, I think, CPython itself. Current Behavior >>> discover(1) ctype("int64") Proposed Behavio... More on github.com
🌐 github.com
September 24, 2014
python - Convert dtype from int64 to int32 - Stack Overflow
Basically, I am using python x32 bit to load from file a list object containing several numpy arrays (previously saved inside a pickle using python x64). I can load them properly and check the con... More on stackoverflow.com
🌐 stackoverflow.com
integer - How does Python manage int and long? - Stack Overflow
The maximum value of the default ... python --version; python -c 'print(type(0x7FFFffffFFFFffff))' Python 2.7.16 mad@shuttle:~$ 2021-05-27T03:41:14.837Z+00:00 ... if Int64 is default, Int8/Int16/Int32 will never be used because Int64 is already larger than them, when ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Reddit
reddit.com › r/learnpython › how to convert python int into numpy.int64?
r/learnpython on Reddit: How to convert python int into numpy.int64?
October 11, 2017 -

Given a variable in python of type int, e.g.

z = 50
type(z) 
## outputs <class 'int'>

is there a straightforward way to convert this variable into numpy.int64?

It appears one would have to convert this variable into a numpy array, and then convert this into int64. That feels quite convoluted.

https://docs.scipy.org/doc/numpy-1.13.0/user/basics.types.html

🌐
Python Data Science Handbook
jakevdp.github.io › PythonDataScienceHandbook › 02.01-understanding-data-types.html
Understanding Data Types in Python | Python Data Science Handbook
The standard Python implementation is written in C. This means that every Python object is simply a cleverly-disguised C structure, which contains not only its value, but other information as well. For example, when we define an integer in Python, such as x = 10000, x is not just a "raw" integer.
🌐
SpaceComplexity
spacecomplexity.ai › blog › int32-vs-int64
int32 vs int64: The Overflow Bug Every Coding Interview Tests · SpaceComplexity
June 18, 2026 - int64 holds up to ~9×10¹⁸, safe for products of any two int32-range values · The classic binary search midpoint bug (lo+hi)/2 overflows int32 when both values are near INT_MAX — Joshua Bloch's 2006 confession from inside the JDK · Signed overflow is undefined behavior in C/C++; Java, ...
🌐
Medium
medium.com › @amit25173 › different-ways-to-convert-numpy-float-to-int-f47f3be42453
Different Ways to Convert NumPy Float to Int | by Amit Yadav | Medium
April 12, 2025 - Yes! By default, NumPy converts floats to 32-bit integers (int32), which means you could run into overflow issues if your numbers are large. Solution? Convert to np.int64 instead!
🌐
Quora
quora.com › What-is-the-difference-between-INT32-and-INT64
What is the difference between INT32 and INT64? - Quora
Answer (1 of 5): An Int32 is a 32 bit signed integer. Int64 is a 64 bit signed integer. A signed integer will give you a positive or negative integer of 2 to the power n-1 minus 1 where n is the bit depth. Therefore a 32 bit signed integer will be plus or minus 2 to the power 31, minus one. The...
🌐
YouTube
youtube.com › watch
NumPy Integer Data Types Explained: int8, int16, int32, int64 Tutorial for Beginners - YouTube
🔢 Master NumPy Integer Data Types in This Complete Beginner's Guide!Learn everything about int8, int16, int32, and int64 in NumPy! This tutorial covers the ...
Published: October 28, 2025
Find elsewhere
🌐
NumPy
numpy.org › doc › stable › user › basics.types.html
Data types — NumPy v2.5 Manual
This means Python integers may expand to accommodate any integer and will not overflow. NumPy provides numpy.iinfo and numpy.finfo to verify the minimum or maximum values of NumPy integer and floating point values respectively · >>> np.iinfo(int) # Bounds of the default integer on this system. iinfo(min=-9223372036854775808, max=9223372036854775807, dtype=int64) >>> np.iinfo(np.int32) # Bounds of a 32-bit integer iinfo(min=-2147483648, max=2147483647, dtype=int32) >>> np.iinfo(np.int64) # Bounds of a 64-bit integer iinfo(min=-9223372036854775808, max=9223372036854775807, dtype=int64)
🌐
GitHub
github.com › pandas-dev › pandas › issues › 622
pandas converts int32 to int64 · Issue #622 · pandas-dev/pandas · GitHub
January 13, 2012 - In [66]: a.dtype Out[66]: dtype('int32') In [67]: b = np.random.randint(2, size=1e6) In [68]: df = pandas.DataFrame({'a': a, 'b': b}) In [69]: df.dtypes Out[69]: a int64 b int64 · Reactions are currently unavailable · Sign up for free to join this conversation on GitHub.
Author: pandas-dev
🌐
GitHub
github.com › blaze › datashape › issues › 95
Discover Python int as int32 instead of int64 · Issue #95 · blaze/datashape · GitHub
September 24, 2014 - Should we default to int32 for basic Python ints? This is more compatible with DyND and, I think, CPython itself. ... This is a bit of a minefield. Depending on the build of Python and the platform, the python integer (i.e. sys.maxint) will be int32 or int64.
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-convert-float64-columns-to-int64-in-pandas
How to Convert float64 Columns to int64 in Pandas? - GeeksforGeeks
July 11, 2024 - This enables the conversion of a column from various data types such as float or string to an integer type, specifically int64 or int32. We can use astype() method in Python to convert float64 Columns to int64 in Pandas.
🌐
NumPy
numpy.org › doc › 2.1 › user › basics.types.html
Data types — NumPy v2.1 Manual
This means Python integers may expand to accommodate any integer and will not overflow. NumPy provides numpy.iinfo and numpy.finfo to verify the minimum or maximum values of NumPy integer and floating point values respectively · >>> np.iinfo(int) # Bounds of the default integer on this system. iinfo(min=-9223372036854775808, max=9223372036854775807, dtype=int64) >>> np.iinfo(np.int32) # Bounds of a 32-bit integer iinfo(min=-2147483648, max=2147483647, dtype=int32) >>> np.iinfo(np.int64) # Bounds of a 64-bit integer iinfo(min=-9223372036854775808, max=9223372036854775807, dtype=int64)
🌐
Fast.ai
forums.fast.ai › fastai
Tensor is int32: upgrading to int64; for better performance use int64 input - fastai - fast.ai Course Forums
October 21, 2019 - Tensor is int32: upgrading to int64; for better performance use int64 input def tensor(x:Any, *rest)->Tensor: "Like `torch.as_tensor`, but handle lists too, and can pass multiple vector elements directly." if len(rest): x = (x,)+rest # XXX: ...
🌐
Medium
medium.com › @bcshamanth › 32-bit-vs-64-bit-choosing-the-right-integer-for-your-needs-bbb6eb7709cf
“32-bit vs. 64-bit: Choosing the Right Integer for Your Needs”
October 20, 2023 - To summarize, the key difference between int-32 and int-64 is the range of the values they can represent and the amount of memory they use. Int64 can represent a wider range of values but consumes more memory compared to int32.
🌐
AskPython
askpython.com › python-modules › pandas › convert-float64-to-int64
How to Convert float64 Columns to int64 in Pandas? - AskPython
February 27, 2023 - It has a pretty straightforward syntax in which one ought to specify the column name for which the data type is to be converted which in this case would be from foat64 to int64. It is evident from the data types displayed previously that the columns ‘Work hrs’ & ‘Salary’ have the float64 data type. Since 64 seems to be the default base for both float & int data types, let us try using the below code to convert the ‘Salary’ column. ... Once the above code is run, let us use the print(df.dtypes) function to have a look at the changes effected. Selected Column Converted to int32!
🌐
GitHub
github.com › numpy › numpy › issues › 12322
dtype(int) is int64 not python int · Issue #12322 · numpy/numpy · GitHub
November 3, 2018 - np.dtype(int) is int64, not python int as expected · np.dtype(int) is expected to be Python compatible integer. Specifically Python integers have unlimited precision, but numpy is limited to only 63 binary digits