|
From: Paul T. <pau...@gm...> - 2012-09-26 16:10:31
|
Thanks. I know when doing 8/9 in python 2.x you get 0. With python 3 you get a decimal (Hooray, Python 3!). I ran the script I submitted with python 3. Do I need to change the defects and totals from integers to floats to make my chart work universally? P. On Wed, Sep 26, 2012 at 4:31 AM, Pierre Haessig <pie...@cr...>wrote: > Hi, > > Just a detail : > > Le 26/09/2012 04:29, Paul Tremblay a écrit : > > percent = (np.divide(the_cumsum, the_sum)) * 100 > > This lines doesn't work on my computer (numpy 1.6.2) > > Indeed, there is a casting issue : > In [2]: percent > Out[2]: array([ 0, 0, 0, 0, 100]) > > However, using the regular "/" operator instead of np.divide gives the > proper result: > In [8]: the_cumsum/the_sum*100 > Out[8]: array([ 42.10526316, 71.05263158, 90.78947368, 97.36842105, > 100. ]) > > Best, > Pierre > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |