-24

I have a question about my Stack Overflow post: Is there a way to round a Pearson coefficient to a set number of decimal places?

I asked this as my first question having searched and searched for a similar situation. It was flagged as duplicate even though it hasn't been asked before just because some aspect of it is basic (round decimals). But the question is more complicated than it looks because I don't want to lose the actual value of the coefficient, just print a shorter version of it. It is extremely disappointing that this community is so unwelcoming to new people and that someone can just unilaterally decide it isn't a good enough question because they know how to do it already or can interpret slightly related solutions easily.

3
  • 4
    because I don't want to lose the actual value of the coefficient, just print a shorter version of it The first duplicate gives the answer to that.
    – Turamarth
    Commented Aug 16, 2020 at 11:26
  • 4
    The first duplicate you were linked to shows you how to format a float to a certain number of decimal places when printing. It doesn't change the value of the referenced variable, so it's the answer you were looking for. Commented Aug 16, 2020 at 11:28
  • 4
    That the number represents a pearson coefficient doesn't matter. It still is a float value and can be used just like any other float value.
    – Turamarth
    Commented Aug 16, 2020 at 11:31

1 Answer 1

16

It was flagged as duplicate even though it hasn't been asked before just because some aspect of it is basic (round decimals).

No, that's literally the entire question—how do I print this floating-point value with only 3 decimal places? Basic questions like that are fine on Stack Overflow, but they're usually duplicates, and this one is no exception.

But the question is more complicated than it looks because I don't want to lose the actual value of the coefficient, just print a shorter version of it.

The solutions to the duplicate question will do precisely that. The print command is not destructive: it will not and cannot change your original value.

It was suggested in the comments that you try this solution. If you'd tried it, you'd see that it would work for you. Clearly, you have not tried it.

If you have tried it, and still can't get it to work or still can't figure out how to apply the solutions given in the proposed duplicate(s), then you should edit your question and include updates on what you've tried and why it isn't working for you. That would make your question no longer a duplicate, and thus eligible to be re-opened. See also: "This question already has answers here" - but it does not. What can I do when I think my question's not a duplicate?

It is extremely disappointing that this community is so unwelcoming to new people and that someone can just unilaterally decide it isn't a good enough question because they know how to do it already or can interpret slightly related solutions easily.

Come now, don't exaggerate. Almost nothing you say here is true:

  • It isn't "unwelcoming to new people" to mark someone's question as a duplicate—giving you a link to a high-quality Q&A with answers that have been vetted over years is both helpful and welcoming.
  • Nor was the decision to mark your question as a duplicate "unilateral", as you claim: there were two different people who voted to close the question, one an expert in Python and the other (myself) a site moderator.
  • Furthermore, no one ever said your question wasn't "good enough"—we merely said it was a duplicate, which is an objective fact.
  • Questions are never closed because the voters "know how to do it already".
4
  • 2
    @Pythonlearner In your question, you show code that includes a print command (third line of three total lines). Here, you say that you're actually using something called plt.text(...). That's something entirely different. Evidently, you included the wrong code in the question.
    – Cody Gray Mod
    Commented Aug 16, 2020 at 11:43
  • 1
    Edit the question so it accurately describes your problem with the code that you're trying to get to work i.e. include that specific code. Describe the output of that code and how it differs from the output you desire. Commented Aug 16, 2020 at 11:49
  • 2
    That's correct. No one can answer a closed question. Note that it's actually good the question was closed early, before it got any answers, because this gives you a chance to edit the question to reflect your actual problem. If it had received answers, then you wouldn't have been able to do that, because your edit would invalidate those answers.
    – Cody Gray Mod
    Commented Aug 16, 2020 at 11:52
  • 1
    I've re-opened it now. Thank you for editing.
    – Cody Gray Mod
    Commented Aug 16, 2020 at 12:01