Need help on formatting of output in pycharm - python












1















I am using JetBrains Pycharm (Windows OS) for python coding. In my code, I read a csv file using pd.read_csv(dataset). Then do few moderation on some of the table columns & finally want to see the updated table, so at the end give the command --> print (dataset).



Now when the modified dataset is printed at the bottom window, all the elements of the dataset are printed in floating point exponential format.



e.g.,
[ 0.00000000e+00 0.00000000e+00 1.00000000e+00 1.65349200e+05
1.36897800e+05 4.71784100e+05]



This is where I need the help. I need the dataset to be printed in flaoting point decimal format or simple decimal format.



How that is possible in the easiest way ?
Also, is there any option in Pycharm, to configure the output format (exponential, decimal etc..) from any setting/configuration window, instead of hard-coding ?










share|improve this question























  • Read what the standard library documentation has to say about the .format() method: docs.python.org/3/library/string.html#formatstrings

    – BoarGules
    Jan 20 at 10:24


















1















I am using JetBrains Pycharm (Windows OS) for python coding. In my code, I read a csv file using pd.read_csv(dataset). Then do few moderation on some of the table columns & finally want to see the updated table, so at the end give the command --> print (dataset).



Now when the modified dataset is printed at the bottom window, all the elements of the dataset are printed in floating point exponential format.



e.g.,
[ 0.00000000e+00 0.00000000e+00 1.00000000e+00 1.65349200e+05
1.36897800e+05 4.71784100e+05]



This is where I need the help. I need the dataset to be printed in flaoting point decimal format or simple decimal format.



How that is possible in the easiest way ?
Also, is there any option in Pycharm, to configure the output format (exponential, decimal etc..) from any setting/configuration window, instead of hard-coding ?










share|improve this question























  • Read what the standard library documentation has to say about the .format() method: docs.python.org/3/library/string.html#formatstrings

    – BoarGules
    Jan 20 at 10:24
















1












1








1








I am using JetBrains Pycharm (Windows OS) for python coding. In my code, I read a csv file using pd.read_csv(dataset). Then do few moderation on some of the table columns & finally want to see the updated table, so at the end give the command --> print (dataset).



Now when the modified dataset is printed at the bottom window, all the elements of the dataset are printed in floating point exponential format.



e.g.,
[ 0.00000000e+00 0.00000000e+00 1.00000000e+00 1.65349200e+05
1.36897800e+05 4.71784100e+05]



This is where I need the help. I need the dataset to be printed in flaoting point decimal format or simple decimal format.



How that is possible in the easiest way ?
Also, is there any option in Pycharm, to configure the output format (exponential, decimal etc..) from any setting/configuration window, instead of hard-coding ?










share|improve this question














I am using JetBrains Pycharm (Windows OS) for python coding. In my code, I read a csv file using pd.read_csv(dataset). Then do few moderation on some of the table columns & finally want to see the updated table, so at the end give the command --> print (dataset).



Now when the modified dataset is printed at the bottom window, all the elements of the dataset are printed in floating point exponential format.



e.g.,
[ 0.00000000e+00 0.00000000e+00 1.00000000e+00 1.65349200e+05
1.36897800e+05 4.71784100e+05]



This is where I need the help. I need the dataset to be printed in flaoting point decimal format or simple decimal format.



How that is possible in the easiest way ?
Also, is there any option in Pycharm, to configure the output format (exponential, decimal etc..) from any setting/configuration window, instead of hard-coding ?







python formatting pycharm output






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 20 at 9:59









DebaDeba

61




61













  • Read what the standard library documentation has to say about the .format() method: docs.python.org/3/library/string.html#formatstrings

    – BoarGules
    Jan 20 at 10:24





















  • Read what the standard library documentation has to say about the .format() method: docs.python.org/3/library/string.html#formatstrings

    – BoarGules
    Jan 20 at 10:24



















Read what the standard library documentation has to say about the .format() method: docs.python.org/3/library/string.html#formatstrings

– BoarGules
Jan 20 at 10:24







Read what the standard library documentation has to say about the .format() method: docs.python.org/3/library/string.html#formatstrings

– BoarGules
Jan 20 at 10:24














1 Answer
1






active

oldest

votes


















1














Use {n}. format ()



For ex: '{:n}'.format(1234))



ds_x=[ 0.00000000e+00, 0.00000000e+00, 1.00000000e+00,1.65349200e+05, 1.36897800e+05, 4.71784100e+05]
# For Numpy arrays use '.astype'
# Copy of the array 'ds_x', cast to a specified type 'float'.
# Note: Try type 'float32' OR 'float64' if the below fails to provide correct precision.
data_set = ds_x.astype(float)
for i in data_set:
print("{:.16f}".format(float(i)))


# More about better precision can be found here



Output:



0.0000000000000000



0.0000000000000000



1.0000000000000000



165349.2000000000116415



136897.7999999999883585



471784.0999999999767169



Or you can use the alternative way:



"%.16f" % (float( 00,1.65349200e+05))


The second question regarding PyCharm. You may want to look into formatting markers . Complete details on reformatting .





Update:




Here is a updated code sample with the dataset that was provided by you.




import numpy as np

ds = np.array([[ 0.00000000e+00, 1.00000000e+00, 0.00000000e+00, 2.86637600e+04, 1.27056210e+05, 2.01126820e+05],
[ 0.00000000e+00, 0.00000000e+00, 1.00000000e+00, 1.44372410e+05, 1.18671850e+05, 3.83199620e+05]])

for data_x in iter(ds):
print()
for data_y in data_x:
print("%.16f" % float(data_y))


output:



0.0000000000000000
1.0000000000000000
0.0000000000000000
28663.7599999999983993
127056.2100000000064028
201126.8200000000069849

0.0000000000000000
0.0000000000000000
1.0000000000000000
144372.4100000000034925
118671.8500000000058208
383199.6199999999953434


Regarding the error:




TypeError: only size-1 arrays can be converted to Python scalars




This is because the dataset that you are using is a Python matrix OR a list of a list / two arrays. The first code sample in this post is using one loop which works with one array; however, since you are using a larger dataset containing two arrays on the first loop it will pass the entire array causing the above error to be outputted. To correct this I simply added a second loop to iterate through each value for each array.






share|improve this answer


























  • Thank you. In my case I want to apply it on a big dataset (ds) having multiple rows & columns. So what I type is - for i in ds_x: print(print("{:.16f}".format(float(i)))) I got the error - line 20, in <module> print("%.2f" % (float(i))) TypeError: only length-1 arrays can be converted to Python scalars

    – Deba
    Jan 20 at 12:08













  • The appears to be numpy related stackoverflow.com/a/36680545/7548672 - try doing data_set = ds_x.astype(float) before the for loop in my above example.

    – Victor S
    Jan 20 at 15:56











  • I have edited my example showing you what I mean.

    – Victor S
    Jan 20 at 15:58











  • Thanks. I'm unlucky again. It still throws the same error - TypeError: only length-1 arrays can be converted to Python scalars. If I print my dataset (ds), it shows the below, which will give you a better idea, what exactly my dataset is - print (ds) [[ 0.00000000e+00 1.00000000e+00 0.00000000e+00 2.86637600e+04 1.27056210e+05 2.01126820e+05] [ 0.00000000e+00 0.00000000e+00 1.00000000e+00 1.44372410e+05 1.18671850e+05 3.83199620e+05]]

    – Deba
    Jan 21 at 8:28













  • I added an update to my post using your dataset. If it is still not what you are looking for, could you please possibly update your original post providing your code which is not working. I will try to edit what I see could be the issue. Thanks.

    – Victor S
    Jan 21 at 16:15













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54275313%2fneed-help-on-formatting-of-output-in-pycharm-python%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Use {n}. format ()



For ex: '{:n}'.format(1234))



ds_x=[ 0.00000000e+00, 0.00000000e+00, 1.00000000e+00,1.65349200e+05, 1.36897800e+05, 4.71784100e+05]
# For Numpy arrays use '.astype'
# Copy of the array 'ds_x', cast to a specified type 'float'.
# Note: Try type 'float32' OR 'float64' if the below fails to provide correct precision.
data_set = ds_x.astype(float)
for i in data_set:
print("{:.16f}".format(float(i)))


# More about better precision can be found here



Output:



0.0000000000000000



0.0000000000000000



1.0000000000000000



165349.2000000000116415



136897.7999999999883585



471784.0999999999767169



Or you can use the alternative way:



"%.16f" % (float( 00,1.65349200e+05))


The second question regarding PyCharm. You may want to look into formatting markers . Complete details on reformatting .





Update:




Here is a updated code sample with the dataset that was provided by you.




import numpy as np

ds = np.array([[ 0.00000000e+00, 1.00000000e+00, 0.00000000e+00, 2.86637600e+04, 1.27056210e+05, 2.01126820e+05],
[ 0.00000000e+00, 0.00000000e+00, 1.00000000e+00, 1.44372410e+05, 1.18671850e+05, 3.83199620e+05]])

for data_x in iter(ds):
print()
for data_y in data_x:
print("%.16f" % float(data_y))


output:



0.0000000000000000
1.0000000000000000
0.0000000000000000
28663.7599999999983993
127056.2100000000064028
201126.8200000000069849

0.0000000000000000
0.0000000000000000
1.0000000000000000
144372.4100000000034925
118671.8500000000058208
383199.6199999999953434


Regarding the error:




TypeError: only size-1 arrays can be converted to Python scalars




This is because the dataset that you are using is a Python matrix OR a list of a list / two arrays. The first code sample in this post is using one loop which works with one array; however, since you are using a larger dataset containing two arrays on the first loop it will pass the entire array causing the above error to be outputted. To correct this I simply added a second loop to iterate through each value for each array.






share|improve this answer


























  • Thank you. In my case I want to apply it on a big dataset (ds) having multiple rows & columns. So what I type is - for i in ds_x: print(print("{:.16f}".format(float(i)))) I got the error - line 20, in <module> print("%.2f" % (float(i))) TypeError: only length-1 arrays can be converted to Python scalars

    – Deba
    Jan 20 at 12:08













  • The appears to be numpy related stackoverflow.com/a/36680545/7548672 - try doing data_set = ds_x.astype(float) before the for loop in my above example.

    – Victor S
    Jan 20 at 15:56











  • I have edited my example showing you what I mean.

    – Victor S
    Jan 20 at 15:58











  • Thanks. I'm unlucky again. It still throws the same error - TypeError: only length-1 arrays can be converted to Python scalars. If I print my dataset (ds), it shows the below, which will give you a better idea, what exactly my dataset is - print (ds) [[ 0.00000000e+00 1.00000000e+00 0.00000000e+00 2.86637600e+04 1.27056210e+05 2.01126820e+05] [ 0.00000000e+00 0.00000000e+00 1.00000000e+00 1.44372410e+05 1.18671850e+05 3.83199620e+05]]

    – Deba
    Jan 21 at 8:28













  • I added an update to my post using your dataset. If it is still not what you are looking for, could you please possibly update your original post providing your code which is not working. I will try to edit what I see could be the issue. Thanks.

    – Victor S
    Jan 21 at 16:15


















1














Use {n}. format ()



For ex: '{:n}'.format(1234))



ds_x=[ 0.00000000e+00, 0.00000000e+00, 1.00000000e+00,1.65349200e+05, 1.36897800e+05, 4.71784100e+05]
# For Numpy arrays use '.astype'
# Copy of the array 'ds_x', cast to a specified type 'float'.
# Note: Try type 'float32' OR 'float64' if the below fails to provide correct precision.
data_set = ds_x.astype(float)
for i in data_set:
print("{:.16f}".format(float(i)))


# More about better precision can be found here



Output:



0.0000000000000000



0.0000000000000000



1.0000000000000000



165349.2000000000116415



136897.7999999999883585



471784.0999999999767169



Or you can use the alternative way:



"%.16f" % (float( 00,1.65349200e+05))


The second question regarding PyCharm. You may want to look into formatting markers . Complete details on reformatting .





Update:




Here is a updated code sample with the dataset that was provided by you.




import numpy as np

ds = np.array([[ 0.00000000e+00, 1.00000000e+00, 0.00000000e+00, 2.86637600e+04, 1.27056210e+05, 2.01126820e+05],
[ 0.00000000e+00, 0.00000000e+00, 1.00000000e+00, 1.44372410e+05, 1.18671850e+05, 3.83199620e+05]])

for data_x in iter(ds):
print()
for data_y in data_x:
print("%.16f" % float(data_y))


output:



0.0000000000000000
1.0000000000000000
0.0000000000000000
28663.7599999999983993
127056.2100000000064028
201126.8200000000069849

0.0000000000000000
0.0000000000000000
1.0000000000000000
144372.4100000000034925
118671.8500000000058208
383199.6199999999953434


Regarding the error:




TypeError: only size-1 arrays can be converted to Python scalars




This is because the dataset that you are using is a Python matrix OR a list of a list / two arrays. The first code sample in this post is using one loop which works with one array; however, since you are using a larger dataset containing two arrays on the first loop it will pass the entire array causing the above error to be outputted. To correct this I simply added a second loop to iterate through each value for each array.






share|improve this answer


























  • Thank you. In my case I want to apply it on a big dataset (ds) having multiple rows & columns. So what I type is - for i in ds_x: print(print("{:.16f}".format(float(i)))) I got the error - line 20, in <module> print("%.2f" % (float(i))) TypeError: only length-1 arrays can be converted to Python scalars

    – Deba
    Jan 20 at 12:08













  • The appears to be numpy related stackoverflow.com/a/36680545/7548672 - try doing data_set = ds_x.astype(float) before the for loop in my above example.

    – Victor S
    Jan 20 at 15:56











  • I have edited my example showing you what I mean.

    – Victor S
    Jan 20 at 15:58











  • Thanks. I'm unlucky again. It still throws the same error - TypeError: only length-1 arrays can be converted to Python scalars. If I print my dataset (ds), it shows the below, which will give you a better idea, what exactly my dataset is - print (ds) [[ 0.00000000e+00 1.00000000e+00 0.00000000e+00 2.86637600e+04 1.27056210e+05 2.01126820e+05] [ 0.00000000e+00 0.00000000e+00 1.00000000e+00 1.44372410e+05 1.18671850e+05 3.83199620e+05]]

    – Deba
    Jan 21 at 8:28













  • I added an update to my post using your dataset. If it is still not what you are looking for, could you please possibly update your original post providing your code which is not working. I will try to edit what I see could be the issue. Thanks.

    – Victor S
    Jan 21 at 16:15
















1












1








1







Use {n}. format ()



For ex: '{:n}'.format(1234))



ds_x=[ 0.00000000e+00, 0.00000000e+00, 1.00000000e+00,1.65349200e+05, 1.36897800e+05, 4.71784100e+05]
# For Numpy arrays use '.astype'
# Copy of the array 'ds_x', cast to a specified type 'float'.
# Note: Try type 'float32' OR 'float64' if the below fails to provide correct precision.
data_set = ds_x.astype(float)
for i in data_set:
print("{:.16f}".format(float(i)))


# More about better precision can be found here



Output:



0.0000000000000000



0.0000000000000000



1.0000000000000000



165349.2000000000116415



136897.7999999999883585



471784.0999999999767169



Or you can use the alternative way:



"%.16f" % (float( 00,1.65349200e+05))


The second question regarding PyCharm. You may want to look into formatting markers . Complete details on reformatting .





Update:




Here is a updated code sample with the dataset that was provided by you.




import numpy as np

ds = np.array([[ 0.00000000e+00, 1.00000000e+00, 0.00000000e+00, 2.86637600e+04, 1.27056210e+05, 2.01126820e+05],
[ 0.00000000e+00, 0.00000000e+00, 1.00000000e+00, 1.44372410e+05, 1.18671850e+05, 3.83199620e+05]])

for data_x in iter(ds):
print()
for data_y in data_x:
print("%.16f" % float(data_y))


output:



0.0000000000000000
1.0000000000000000
0.0000000000000000
28663.7599999999983993
127056.2100000000064028
201126.8200000000069849

0.0000000000000000
0.0000000000000000
1.0000000000000000
144372.4100000000034925
118671.8500000000058208
383199.6199999999953434


Regarding the error:




TypeError: only size-1 arrays can be converted to Python scalars




This is because the dataset that you are using is a Python matrix OR a list of a list / two arrays. The first code sample in this post is using one loop which works with one array; however, since you are using a larger dataset containing two arrays on the first loop it will pass the entire array causing the above error to be outputted. To correct this I simply added a second loop to iterate through each value for each array.






share|improve this answer















Use {n}. format ()



For ex: '{:n}'.format(1234))



ds_x=[ 0.00000000e+00, 0.00000000e+00, 1.00000000e+00,1.65349200e+05, 1.36897800e+05, 4.71784100e+05]
# For Numpy arrays use '.astype'
# Copy of the array 'ds_x', cast to a specified type 'float'.
# Note: Try type 'float32' OR 'float64' if the below fails to provide correct precision.
data_set = ds_x.astype(float)
for i in data_set:
print("{:.16f}".format(float(i)))


# More about better precision can be found here



Output:



0.0000000000000000



0.0000000000000000



1.0000000000000000



165349.2000000000116415



136897.7999999999883585



471784.0999999999767169



Or you can use the alternative way:



"%.16f" % (float( 00,1.65349200e+05))


The second question regarding PyCharm. You may want to look into formatting markers . Complete details on reformatting .





Update:




Here is a updated code sample with the dataset that was provided by you.




import numpy as np

ds = np.array([[ 0.00000000e+00, 1.00000000e+00, 0.00000000e+00, 2.86637600e+04, 1.27056210e+05, 2.01126820e+05],
[ 0.00000000e+00, 0.00000000e+00, 1.00000000e+00, 1.44372410e+05, 1.18671850e+05, 3.83199620e+05]])

for data_x in iter(ds):
print()
for data_y in data_x:
print("%.16f" % float(data_y))


output:



0.0000000000000000
1.0000000000000000
0.0000000000000000
28663.7599999999983993
127056.2100000000064028
201126.8200000000069849

0.0000000000000000
0.0000000000000000
1.0000000000000000
144372.4100000000034925
118671.8500000000058208
383199.6199999999953434


Regarding the error:




TypeError: only size-1 arrays can be converted to Python scalars




This is because the dataset that you are using is a Python matrix OR a list of a list / two arrays. The first code sample in this post is using one loop which works with one array; however, since you are using a larger dataset containing two arrays on the first loop it will pass the entire array causing the above error to be outputted. To correct this I simply added a second loop to iterate through each value for each array.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 22 at 1:12

























answered Jan 20 at 10:39









Victor SVictor S

1798




1798













  • Thank you. In my case I want to apply it on a big dataset (ds) having multiple rows & columns. So what I type is - for i in ds_x: print(print("{:.16f}".format(float(i)))) I got the error - line 20, in <module> print("%.2f" % (float(i))) TypeError: only length-1 arrays can be converted to Python scalars

    – Deba
    Jan 20 at 12:08













  • The appears to be numpy related stackoverflow.com/a/36680545/7548672 - try doing data_set = ds_x.astype(float) before the for loop in my above example.

    – Victor S
    Jan 20 at 15:56











  • I have edited my example showing you what I mean.

    – Victor S
    Jan 20 at 15:58











  • Thanks. I'm unlucky again. It still throws the same error - TypeError: only length-1 arrays can be converted to Python scalars. If I print my dataset (ds), it shows the below, which will give you a better idea, what exactly my dataset is - print (ds) [[ 0.00000000e+00 1.00000000e+00 0.00000000e+00 2.86637600e+04 1.27056210e+05 2.01126820e+05] [ 0.00000000e+00 0.00000000e+00 1.00000000e+00 1.44372410e+05 1.18671850e+05 3.83199620e+05]]

    – Deba
    Jan 21 at 8:28













  • I added an update to my post using your dataset. If it is still not what you are looking for, could you please possibly update your original post providing your code which is not working. I will try to edit what I see could be the issue. Thanks.

    – Victor S
    Jan 21 at 16:15





















  • Thank you. In my case I want to apply it on a big dataset (ds) having multiple rows & columns. So what I type is - for i in ds_x: print(print("{:.16f}".format(float(i)))) I got the error - line 20, in <module> print("%.2f" % (float(i))) TypeError: only length-1 arrays can be converted to Python scalars

    – Deba
    Jan 20 at 12:08













  • The appears to be numpy related stackoverflow.com/a/36680545/7548672 - try doing data_set = ds_x.astype(float) before the for loop in my above example.

    – Victor S
    Jan 20 at 15:56











  • I have edited my example showing you what I mean.

    – Victor S
    Jan 20 at 15:58











  • Thanks. I'm unlucky again. It still throws the same error - TypeError: only length-1 arrays can be converted to Python scalars. If I print my dataset (ds), it shows the below, which will give you a better idea, what exactly my dataset is - print (ds) [[ 0.00000000e+00 1.00000000e+00 0.00000000e+00 2.86637600e+04 1.27056210e+05 2.01126820e+05] [ 0.00000000e+00 0.00000000e+00 1.00000000e+00 1.44372410e+05 1.18671850e+05 3.83199620e+05]]

    – Deba
    Jan 21 at 8:28













  • I added an update to my post using your dataset. If it is still not what you are looking for, could you please possibly update your original post providing your code which is not working. I will try to edit what I see could be the issue. Thanks.

    – Victor S
    Jan 21 at 16:15



















Thank you. In my case I want to apply it on a big dataset (ds) having multiple rows & columns. So what I type is - for i in ds_x: print(print("{:.16f}".format(float(i)))) I got the error - line 20, in <module> print("%.2f" % (float(i))) TypeError: only length-1 arrays can be converted to Python scalars

– Deba
Jan 20 at 12:08







Thank you. In my case I want to apply it on a big dataset (ds) having multiple rows & columns. So what I type is - for i in ds_x: print(print("{:.16f}".format(float(i)))) I got the error - line 20, in <module> print("%.2f" % (float(i))) TypeError: only length-1 arrays can be converted to Python scalars

– Deba
Jan 20 at 12:08















The appears to be numpy related stackoverflow.com/a/36680545/7548672 - try doing data_set = ds_x.astype(float) before the for loop in my above example.

– Victor S
Jan 20 at 15:56





The appears to be numpy related stackoverflow.com/a/36680545/7548672 - try doing data_set = ds_x.astype(float) before the for loop in my above example.

– Victor S
Jan 20 at 15:56













I have edited my example showing you what I mean.

– Victor S
Jan 20 at 15:58





I have edited my example showing you what I mean.

– Victor S
Jan 20 at 15:58













Thanks. I'm unlucky again. It still throws the same error - TypeError: only length-1 arrays can be converted to Python scalars. If I print my dataset (ds), it shows the below, which will give you a better idea, what exactly my dataset is - print (ds) [[ 0.00000000e+00 1.00000000e+00 0.00000000e+00 2.86637600e+04 1.27056210e+05 2.01126820e+05] [ 0.00000000e+00 0.00000000e+00 1.00000000e+00 1.44372410e+05 1.18671850e+05 3.83199620e+05]]

– Deba
Jan 21 at 8:28







Thanks. I'm unlucky again. It still throws the same error - TypeError: only length-1 arrays can be converted to Python scalars. If I print my dataset (ds), it shows the below, which will give you a better idea, what exactly my dataset is - print (ds) [[ 0.00000000e+00 1.00000000e+00 0.00000000e+00 2.86637600e+04 1.27056210e+05 2.01126820e+05] [ 0.00000000e+00 0.00000000e+00 1.00000000e+00 1.44372410e+05 1.18671850e+05 3.83199620e+05]]

– Deba
Jan 21 at 8:28















I added an update to my post using your dataset. If it is still not what you are looking for, could you please possibly update your original post providing your code which is not working. I will try to edit what I see could be the issue. Thanks.

– Victor S
Jan 21 at 16:15







I added an update to my post using your dataset. If it is still not what you are looking for, could you please possibly update your original post providing your code which is not working. I will try to edit what I see could be the issue. Thanks.

– Victor S
Jan 21 at 16:15






















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54275313%2fneed-help-on-formatting-of-output-in-pycharm-python%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Homophylophilia

Updating UILabel text programmatically using a function

Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage