What did the 'new' parameter in numpy's histogram() function do?












2















I stumbled across some old code (>10 years) and one of the lines reads:



c, be = np.histogram(s, bins=values, new=True)


This new parameter is no longer there. I'm trying to make this code work, but I've no idea what that new parameter did. I haven't found anything about it online. I could just remove it, but then I wouldn't know what it was used for and if it was perhaps something important.



Can anybody tell me what this parameter did and how can it be reproduced now?










share|improve this question


















  • 2





    docs.scipy.org/doc/numpy-1.3.x/reference/generated/…. TLDR it was removed in 1.4

    – user3483203
    Nov 23 '18 at 15:41


















2















I stumbled across some old code (>10 years) and one of the lines reads:



c, be = np.histogram(s, bins=values, new=True)


This new parameter is no longer there. I'm trying to make this code work, but I've no idea what that new parameter did. I haven't found anything about it online. I could just remove it, but then I wouldn't know what it was used for and if it was perhaps something important.



Can anybody tell me what this parameter did and how can it be reproduced now?










share|improve this question


















  • 2





    docs.scipy.org/doc/numpy-1.3.x/reference/generated/…. TLDR it was removed in 1.4

    – user3483203
    Nov 23 '18 at 15:41
















2












2








2








I stumbled across some old code (>10 years) and one of the lines reads:



c, be = np.histogram(s, bins=values, new=True)


This new parameter is no longer there. I'm trying to make this code work, but I've no idea what that new parameter did. I haven't found anything about it online. I could just remove it, but then I wouldn't know what it was used for and if it was perhaps something important.



Can anybody tell me what this parameter did and how can it be reproduced now?










share|improve this question














I stumbled across some old code (>10 years) and one of the lines reads:



c, be = np.histogram(s, bins=values, new=True)


This new parameter is no longer there. I'm trying to make this code work, but I've no idea what that new parameter did. I haven't found anything about it online. I could just remove it, but then I wouldn't know what it was used for and if it was perhaps something important.



Can anybody tell me what this parameter did and how can it be reproduced now?







python numpy legacy-code






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 15:30









GabrielGabriel

11.5k34119237




11.5k34119237








  • 2





    docs.scipy.org/doc/numpy-1.3.x/reference/generated/…. TLDR it was removed in 1.4

    – user3483203
    Nov 23 '18 at 15:41
















  • 2





    docs.scipy.org/doc/numpy-1.3.x/reference/generated/…. TLDR it was removed in 1.4

    – user3483203
    Nov 23 '18 at 15:41










2




2





docs.scipy.org/doc/numpy-1.3.x/reference/generated/…. TLDR it was removed in 1.4

– user3483203
Nov 23 '18 at 15:41







docs.scipy.org/doc/numpy-1.3.x/reference/generated/…. TLDR it was removed in 1.4

– user3483203
Nov 23 '18 at 15:41














1 Answer
1






active

oldest

votes


















1














That argument allowed the older version to provide bin creation functionality equal to that of newer versions (>= 1.3). I found the following note in code at this link




Either an integer number of bins or a sequence giving the
bins. If bins is an integer, bins + 1 bin edges
will be returned, consistent with :func:numpy.histogram
for numpy version >= 1.3, and with the new = True argument
in earlier versions.




And this from the docs linked in the comment:




new : {None, True, False}, optional



Whether to use the new semantics for histogram:




  • None : the new behaviour is used, no warning is printed.

  • True : the new behaviour is used and a warning is raised about the future removal of the new keyword.

  • False : the old behaviour is used and a DeprecationWarning is raised.


As of NumPy 1.3, this keyword should not be used explicitly since it will disappear in NumPy 1.4.







share|improve this answer





















  • 1





    So it appears that it can indeed be removed with no unexpected consequences. Thank you!

    – Gabriel
    Nov 23 '18 at 15:54











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%2f53449370%2fwhat-did-the-new-parameter-in-numpys-histogram-function-do%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














That argument allowed the older version to provide bin creation functionality equal to that of newer versions (>= 1.3). I found the following note in code at this link




Either an integer number of bins or a sequence giving the
bins. If bins is an integer, bins + 1 bin edges
will be returned, consistent with :func:numpy.histogram
for numpy version >= 1.3, and with the new = True argument
in earlier versions.




And this from the docs linked in the comment:




new : {None, True, False}, optional



Whether to use the new semantics for histogram:




  • None : the new behaviour is used, no warning is printed.

  • True : the new behaviour is used and a warning is raised about the future removal of the new keyword.

  • False : the old behaviour is used and a DeprecationWarning is raised.


As of NumPy 1.3, this keyword should not be used explicitly since it will disappear in NumPy 1.4.







share|improve this answer





















  • 1





    So it appears that it can indeed be removed with no unexpected consequences. Thank you!

    – Gabriel
    Nov 23 '18 at 15:54
















1














That argument allowed the older version to provide bin creation functionality equal to that of newer versions (>= 1.3). I found the following note in code at this link




Either an integer number of bins or a sequence giving the
bins. If bins is an integer, bins + 1 bin edges
will be returned, consistent with :func:numpy.histogram
for numpy version >= 1.3, and with the new = True argument
in earlier versions.




And this from the docs linked in the comment:




new : {None, True, False}, optional



Whether to use the new semantics for histogram:




  • None : the new behaviour is used, no warning is printed.

  • True : the new behaviour is used and a warning is raised about the future removal of the new keyword.

  • False : the old behaviour is used and a DeprecationWarning is raised.


As of NumPy 1.3, this keyword should not be used explicitly since it will disappear in NumPy 1.4.







share|improve this answer





















  • 1





    So it appears that it can indeed be removed with no unexpected consequences. Thank you!

    – Gabriel
    Nov 23 '18 at 15:54














1












1








1







That argument allowed the older version to provide bin creation functionality equal to that of newer versions (>= 1.3). I found the following note in code at this link




Either an integer number of bins or a sequence giving the
bins. If bins is an integer, bins + 1 bin edges
will be returned, consistent with :func:numpy.histogram
for numpy version >= 1.3, and with the new = True argument
in earlier versions.




And this from the docs linked in the comment:




new : {None, True, False}, optional



Whether to use the new semantics for histogram:




  • None : the new behaviour is used, no warning is printed.

  • True : the new behaviour is used and a warning is raised about the future removal of the new keyword.

  • False : the old behaviour is used and a DeprecationWarning is raised.


As of NumPy 1.3, this keyword should not be used explicitly since it will disappear in NumPy 1.4.







share|improve this answer















That argument allowed the older version to provide bin creation functionality equal to that of newer versions (>= 1.3). I found the following note in code at this link




Either an integer number of bins or a sequence giving the
bins. If bins is an integer, bins + 1 bin edges
will be returned, consistent with :func:numpy.histogram
for numpy version >= 1.3, and with the new = True argument
in earlier versions.




And this from the docs linked in the comment:




new : {None, True, False}, optional



Whether to use the new semantics for histogram:




  • None : the new behaviour is used, no warning is printed.

  • True : the new behaviour is used and a warning is raised about the future removal of the new keyword.

  • False : the old behaviour is used and a DeprecationWarning is raised.


As of NumPy 1.3, this keyword should not be used explicitly since it will disappear in NumPy 1.4.








share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 23 '18 at 15:55

























answered Nov 23 '18 at 15:41









DodgeDodge

1,4291922




1,4291922








  • 1





    So it appears that it can indeed be removed with no unexpected consequences. Thank you!

    – Gabriel
    Nov 23 '18 at 15:54














  • 1





    So it appears that it can indeed be removed with no unexpected consequences. Thank you!

    – Gabriel
    Nov 23 '18 at 15:54








1




1





So it appears that it can indeed be removed with no unexpected consequences. Thank you!

– Gabriel
Nov 23 '18 at 15:54





So it appears that it can indeed be removed with no unexpected consequences. Thank you!

– Gabriel
Nov 23 '18 at 15:54


















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%2f53449370%2fwhat-did-the-new-parameter-in-numpys-histogram-function-do%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

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python