##### System showing np.int64(xxx) as output
 System showing np.int64(xxx) as output leea2024 Programmer named Tim Posts: 8 Threads: 4 Joined: Aug 2024 Reputation: Aug-10-2024, 06:06 AM I was using Numpy and try to find the number in an array which is the closest to the number 57. I write the following code. ```a = np.array([78,22,65,87,12,98,63,79]) x = 57 a[np.argmin(np.abs(a - x))]```The output I get is ``Output:np.int64(63)`` instead of 63 only. I am guessing it has to do with some setting in my system. Can you explain how I can get the number only without the data type? Thanks in advance. Reply paul18fr Spam, spam, eggs, and spam Posts: 283 Threads: 64 Joined: Apr 2019 Reputation: Aug-10-2024, 07:32 AM it seems correct ... ```import numpy as np a = np.array([78, 22, 65, 87, 12, 98, 63, 79]) x = 57 Index = np.argmin(np.abs(a - x)) minValue = a[Index] print(f"Index = {Index} & min difference = {minValue}") r = a[np.argmin(np.abs(a - x))] print(f"r = {r}")`````````Output:Index = 6 & min difference = 63 r = 63`````` leea2024 likes this post Reply Posts: 6,551 Threads: 19 Joined: Feb 2020 Reputation: Aug-10-2024, 10:20 AM (This post was last modified: Aug-10-2024, 10:20 AM by deanhystad.) Are you running the code in an anaconda notebook? When I run your code as a program or in the interactive interpreter I don't see the np.int64() part. If you don't like the way the value is displayed, use the print() command. leea2024 likes this post Reply leea2024 Programmer named Tim Posts: 8 Threads: 4 Joined: Aug 2024 Reputation: Aug-10-2024, 10:55 AM (Aug-10-2024, 10:20 AM)deanhystad Wrote: Are you running the code in an anaconda notebook? When I run your code as a program or in the interactive interpreter I don't see the np.int64() part. If you don't like the way the value is displayed, use the print() command. Yes, I am running my code in JupyterLab. Would you mind telling me why the output is different in JupyterLab? Reply

 Possibly Related Threads… Thread Author Replies Views Last Post Showing and saving the output of a python file run through bash Rim 3 3,281 Oct-06-2021, 10:48 AM Last Post: gerpark Difference between os.system("clear") and os.system("cls") chmsrohit 7 17,558 Jan-11-2021, 06:30 PM Last Post: ykumar34 Difference between Python's os.system and Perl's system command Agile741 13 7,803 Dec-02-2019, 04:41 PM Last Post: Agile741 Not Getting The desired output on my system Rashi 12 8,779 Apr-24-2017, 06:33 AM Last Post: Rashi os.system Output S0undwav3 8 25,241 Mar-02-2017, 06:13 PM Last Post: zivoni

Forum Jump:

### User Panel Messages

##### Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020