What did the 'new' parameter in numpy's histogram() function do?
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
add a comment |
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
2
docs.scipy.org/doc/numpy-1.3.x/reference/generated/…. TLDR it was removed in1.4
– user3483203
Nov 23 '18 at 15:41
add a comment |
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
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
python numpy legacy-code
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 in1.4
– user3483203
Nov 23 '18 at 15:41
add a comment |
2
docs.scipy.org/doc/numpy-1.3.x/reference/generated/…. TLDR it was removed in1.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
add a comment |
1 Answer
1
active
oldest
votes
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.
1
So it appears that it can indeed be removed with no unexpected consequences. Thank you!
– Gabriel
Nov 23 '18 at 15:54
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
1
So it appears that it can indeed be removed with no unexpected consequences. Thank you!
– Gabriel
Nov 23 '18 at 15:54
add a comment |
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.
1
So it appears that it can indeed be removed with no unexpected consequences. Thank you!
– Gabriel
Nov 23 '18 at 15:54
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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