Comments (8)
Oh yes, forgot about negative value... Many thanks.
Could make a PR ?
from numpy-100.
Ok, will try do that soon.
On Tue, Jul 26, 2016 at 12:05 PM, Nicolas P. Rougier <
[email protected]> wrote:
Oh yes, forgot about negative value... Many thanks.
Could make a PR ?—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#15 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AO-LbGQGWNKpQ3XKBFpTAOB73CQzYHcjks5qZj5TgaJpZM4JVPaJ
.
from numpy-100.
Thanks !
from numpy-100.
round() also doesn't work properly, as 1, 3, 5, ... are rounded to 2, 4, 6 (instead of 1, 3, 5)
I suggest following solution:
print(np.copysign(np.ceil(np.abs(Z)), Z))
from numpy-100.
What is your numpy version ? For me np.round(1.0)
gives me 1.0
from numpy-100.
Numpy 1.11.1
The code:
Z = np.array([1.0, 1.5, 2.0, 2.5, 3.0, 3.5])
print (np.round(Z + np.copysign(0.5, Z)))
for me prints:
[ 2. 2. 2. 3. 4. 4.]
while it should be:
[ 1. 2. 2. 3. 3. 4.]
I think this is because "For values exactly halfway between rounded decimal values, Numpy rounds to the nearest even value.", http://docs.scipy.org/doc/numpy/reference/generated/numpy.around.html
from numpy-100.
Ah ok. Sorry, I did not understand your first example.
Could you make a PR with your changes ?
from numpy-100.
Yes, I wasn't clear in my first example.
I just created the PR. Please comment/modify in case I did anything wrong, as this is my first PR on github.
Thanks,
from numpy-100.
Related Issues (20)
- The solution to Q60 is not clear HOT 2
- An alternative solution for Q.63 (Typo) HOT 1
- Possibly Faster solution for #66 HOT 8
- np.eye(10)[4] for Q.6?
- Numpy-100
- about question 5 HOT 3
- Query about Question 3 HOT 1
- An alternative solution for Q.19 HOT 2
- About question 19 HOT 1
- about question 18 HOT 1
- Question # 35 HOT 1
- Typo: 86. ... matrices wich shape ... -> ... matrices with shape ... HOT 2
- Alternative solution to q4 HOT 2
- 12345
- can't enter the normal binder HOT 1
- Solution for Q10 is not entirely correct. HOT 1
- #4 memory size of any array HOT 1
- Q.83 - `np.bincount` doesn't work on negative values HOT 2
- #56 Doesn't use the fact a 2d gaussian is separable and only works for mu=0.0 HOT 1
- #52 question HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from numpy-100.