Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
scientific numbers
#1
Dear Python Experts,
I got an array (called tpr) that has scientific numbers like 0.00000000e+00 9.37207123e-04 2.99906279e-03 3.28022493e-03
Is there a way to convert them to normal numbers?

Thats how the array gets produced:

from sklearn import metrics

fpr, tpr, thresholds = metrics.roc_curve(y_train1.nlargest(15251), y_score[:, 1])
Reply
#2
Since this function appears to return Numpy arrays and that the Decimal object will happily take scientific notation and convert to 'regular' notation, you can try the following:

from decimal import Decimal

# ...
fpr, tpr, thresholds = metrics.roc_curve(y_train1.nlargest(15251), y_score[:, 1])
print(tpr.astype(Decimal))
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Random Generator: From Word to Numbers, from Numbers to n possibles Words Yamiyozx 2 1,417 Jan-02-2023, 05:08 PM
Last Post: deanhystad
  Convert list of numbers to string of numbers kam_uk 5 3,001 Nov-21-2020, 03:10 PM
Last Post: deanhystad
  Scientific Calculator Spacecowboy 5 3,885 Dec-04-2019, 09:36 PM
Last Post: Clunk_Head
  i need help in fixing my scientific calculator coding : (, im using python 3.5.5 hans77 1 4,166 Oct-17-2018, 03:26 AM
Last Post: stullis
  Regular Expressions in Files (find all phone numbers and credit card numbers) Amirsalar 2 4,100 Dec-05-2017, 09:48 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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