Convert numpy int64 to python int

Use .item ()

import numpy as np

#numpy int64
np_int = np.int64(0)
print(type(np_int))
# <class 'numpy.int64'>

#Convert to python int
py_int = np_int.item()
print(type(py_int))
# <class 'int'>

reference

Recommended Posts

Convert numpy int64 to python int
[python] Convert date to string
[Python] Convert list to Pandas [Pandas]
Convert Scratch project to Python
[Python] Convert Shift_JIS to UTF-8
Convert python 3.x code to python 2.x
Convert NumPy array "ndarray" to lilt in Python [tolist ()]
Convert elements of numpy array from float to int
Subscript access to python numpy array
Introduction to Python Numerical Library NumPy
Convert markdown to PDF in Python
[Introduction to Python] <numpy ndarray> [edit: 2020/02/22]
Workflow to convert formula (image) to python
Convert list to DataFrame with python
Python> list> Convert double list to single list
[Python] Convert natural numbers to ordinal numbers
Convert decimal numbers to n-ary numbers [python]
Python> tuple> Convert double tuple to single tuple
How to convert Python # type for Python super beginners: int, float
My Numpy (Python)
[Python] How to convert db file to csv
Updated to Python 2.7.9
Convert memo at once with Python 2to3
Convert to HSV
Convert Python> two value sequence to dictionary
[Python] How to convert a 2D list to a 1D list
How to convert Python to an exe file
[Python] Convert csv file delimiters to tab delimiters
Convert psd file to png in Python
Convert Excel data to JSON with python
Convert Hiragana to Romaji with Python (Beta)
Convert from katakana to vowel kana [python]
Convert FX 1-minute data to 5-minute data with Python
python> Convert tuple to list> aList = list (pi_tuple)
#Python basics (#Numpy 1/2)
#Python basics (#Numpy 2/2)
Convert Python date types to RFC822 format
Convert HEIC files to PNG files with Python
Convert Chinese numerals to Arabic numerals with Python
Convert from Markdown to HTML in Python
Python #Numpy basics
Convert absolute URLs to relative URLs in Python
[Python] Numpy memo
"Backport" to python 2
Sample to convert image to Wavelet with Python
Python code to convert region mesh code to latitude / longitude
Convert FBX files to ASCII <-> BINARY in Python
[Python] Road to a snake charmer (4) Tweak Numpy
Convert data with shape (number of data, 1) to (number of data,) with numpy.
Convert PDF to image (JPEG / PNG) with Python
Convert "number" of excel date to python datetime
Convert PDFs to images in bulk with Python
Python script to convert latitude / longitude to mesh code
[Python] Convert from DICOM to PNG or CSV
Convert svg file to png / ico with Python
Convert Windows epoch values to date with python
How to convert SVG to PDF and PNG [Python]
Convert STL to Voxel mesh using Python VTK
Convert exponential notation float to str in Python
How to make Python faster for beginners [numpy]
Convert cubic mesh code to WKT in Python