You can subscribe to this list here.
2000 |
Jan
(8) |
Feb
(49) |
Mar
(48) |
Apr
(28) |
May
(37) |
Jun
(28) |
Jul
(16) |
Aug
(16) |
Sep
(44) |
Oct
(61) |
Nov
(31) |
Dec
(24) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(56) |
Feb
(54) |
Mar
(41) |
Apr
(71) |
May
(48) |
Jun
(32) |
Jul
(53) |
Aug
(91) |
Sep
(56) |
Oct
(33) |
Nov
(81) |
Dec
(54) |
2002 |
Jan
(72) |
Feb
(37) |
Mar
(126) |
Apr
(62) |
May
(34) |
Jun
(124) |
Jul
(36) |
Aug
(34) |
Sep
(60) |
Oct
(37) |
Nov
(23) |
Dec
(104) |
2003 |
Jan
(110) |
Feb
(73) |
Mar
(42) |
Apr
(8) |
May
(76) |
Jun
(14) |
Jul
(52) |
Aug
(26) |
Sep
(108) |
Oct
(82) |
Nov
(89) |
Dec
(94) |
2004 |
Jan
(117) |
Feb
(86) |
Mar
(75) |
Apr
(55) |
May
(75) |
Jun
(160) |
Jul
(152) |
Aug
(86) |
Sep
(75) |
Oct
(134) |
Nov
(62) |
Dec
(60) |
2005 |
Jan
(187) |
Feb
(318) |
Mar
(296) |
Apr
(205) |
May
(84) |
Jun
(63) |
Jul
(122) |
Aug
(59) |
Sep
(66) |
Oct
(148) |
Nov
(120) |
Dec
(70) |
2006 |
Jan
(460) |
Feb
(683) |
Mar
(589) |
Apr
(559) |
May
(445) |
Jun
(712) |
Jul
(815) |
Aug
(663) |
Sep
(559) |
Oct
(930) |
Nov
(373) |
Dec
|
From: <R....@ma...> - 2006-09-03 23:00:57
|
I will be out of the office starting 09/04/2006 and will not return until 09/25/2006. I will respond to your message when I return. For urgent matters please contact Ton van de Peut: T.v...@ma... |
From: Robert K. <rob...@gm...> - 2006-09-03 21:54:17
|
Charles R Harris wrote: > On 9/3/06, *Fernando Perez* <Fer...@co... > <mailto:Fer...@co...>> wrote: > > Hi all, > > I'm wondering if the following difference in behavior of object > arrays should > be considered a bug. Let a and b be: > > In [21]: a = [0,1] > > In [22]: b = [ None, None] > > If we concatenate a with an empty list, it works: > > In [23]: numpy.concatenate(([],a)) > Out[23]: array([0, 1]) > > But not so for b: > > In [24]: numpy.concatenate(([],b)) > --------------------------------------------------------------------------- > exceptions.ValueError Traceback > (most recent > call last) > > /home/fperez/<ipython console> > > ValueError: 0-d arrays can't be concatenated > > > I think it's propably a bug: > > >>> concatenate((array([]),b)) > array([None, None], dtype=object) Well, if you can fix it without breaking anything else, then it's a bug. However, I would suggest that a rule of thumb for using object arrays is to always be explicit. Never rely on automatic conversion from Python containers to object arrays. Since Python containers are also objects, it is usually ambiguous what the user meant. I kind of liked numarray's choice to move the object array into a separate constructor. I think that gave them some flexibility to choose different syntax and semantics from the generic array() constructor. Since constructing object arrays is so different from constructing numeric arrays, I think that difference is warranted. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco |
From: Charles R H. <cha...@gm...> - 2006-09-03 20:43:44
|
On 9/3/06, Fernando Perez <Fer...@co...> wrote: > > Hi all, > > I'm wondering if the following difference in behavior of object arrays > should > be considered a bug. Let a and b be: > > In [21]: a = [0,1] > > In [22]: b = [ None, None] > > If we concatenate a with an empty list, it works: > > In [23]: numpy.concatenate(([],a)) > Out[23]: array([0, 1]) > > But not so for b: > > In [24]: numpy.concatenate(([],b)) > > --------------------------------------------------------------------------- > exceptions.ValueError Traceback (most > recent > call last) > > /home/fperez/<ipython console> > > ValueError: 0-d arrays can't be concatenated I think it's propably a bug: >>> concatenate((array([]),b)) array([None, None], dtype=object) Chuck |
From: Nils W. <nw...@ia...> - 2006-09-03 19:32:03
|
On Sun, 3 Sep 2006 12:20:09 -0600 "Charles R Harris" <cha...@gm...> wrote: > Travis has introduced the function diagflat for creating=20 >diagonal arrays. It > flattens whatever array is supplied and returns its=20 >values as the diagonal > of a 2-D array or matrix. As the function is currently=20 >undocumented I > thought now might be a good time to discuss other=20 >possible choices for the > name. Here is a quick list that comes to mind >=20 > diagflat (current name) > asdiagonal > todiagonal > asdiag > todiag > ... >=20 > Chuck +1 for todiag Nils |
From: Fernando P. <Fer...@co...> - 2006-09-03 19:14:31
|
Hi all, I'm wondering if the following difference in behavior of object arrays should be considered a bug. Let a and b be: In [21]: a = [0,1] In [22]: b = [ None, None] If we concatenate a with an empty list, it works: In [23]: numpy.concatenate(([],a)) Out[23]: array([0, 1]) But not so for b: In [24]: numpy.concatenate(([],b)) --------------------------------------------------------------------------- exceptions.ValueError Traceback (most recent call last) /home/fperez/<ipython console> ValueError: 0-d arrays can't be concatenated This behavior changed recently (it used to work with r2788), and I realize it's probably part of all the reworkings of the object arrays which have been discussed on the list, and all of whose details I have to admit I haven't followed. But this behavior strikes me as a bit inconsistent, since concatenation with a non-empty object array works fine: In [26]: numpy.concatenate(([None],b)) Out[26]: array([None, None, None], dtype=object) This is biting us in some code which keeps object arrays, because when operations of the kind N.concatenate((some_list_of_objects[:nn],other_object_array)) are taken and nn happens to be 0, the code just explodes. In our case, the variable nn is a runtime computed quantity that comes from a numerical algorithm, for which 0 is a perfectly reasonable value. Are we just misusing things and is there a reasonable alternative, or should this be considered a numpy bug? The r2788 behavior was certainly a lot less surprising as far as our code was concerned. I realize that one alternative is to wrap everything into arrays: N.concatenate((N.asarray(some_list_of_objects[:nn]),other_object_array)) Is this the only solution moving forward, or could the previous behavior be restored without breaking other areas of the new code/design? Thanks for any input, f |
From: Charles R H. <cha...@gm...> - 2006-09-03 18:20:12
|
Travis has introduced the function diagflat for creating diagonal arrays. It flattens whatever array is supplied and returns its values as the diagonal of a 2-D array or matrix. As the function is currently undocumented I thought now might be a good time to discuss other possible choices for the name. Here is a quick list that comes to mind diagflat (current name) asdiagonal todiagonal asdiag todiag ... Chuck |
From: Robert K. <rob...@gm...> - 2006-09-03 05:11:11
|
Bill Spotz wrote: > I think I see a bug in lib.user_array.container class. The __eq__ > method is > > def __eq__(self,other): return self._rc(equal(self.array,other)) > > the expression equal(self.array,other) will return an ndarray of > bools, which is then converted, by way of self._rc(), to whatever the > derived class is. In my case, this does not make sense, because an > array of bools is not a valid argument to the constructor (actually, > the data buffer is accepted, but the results are not reliable). What > I want, and it seem most people would want in this situation, is just > the array of bools; i.e. don't apply the self._rc() method. No, it's not a bug. It's just the design of that class: always return the same class of object. Of course, since that class only exists to be subclassed, if you need different behavior from those methods, override them. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco |
From: Bill S. <wf...@sa...> - 2006-09-03 04:48:18
|
I think I see a bug in lib.user_array.container class. The __eq__ method is def __eq__(self,other): return self._rc(equal(self.array,other)) the expression equal(self.array,other) will return an ndarray of bools, which is then converted, by way of self._rc(), to whatever the derived class is. In my case, this does not make sense, because an array of bools is not a valid argument to the constructor (actually, the data buffer is accepted, but the results are not reliable). What I want, and it seem most people would want in this situation, is just the array of bools; i.e. don't apply the self._rc() method. Assuming there is agreement that this is the desirable behavior, the same would be true for __lt__, __le__, etc. I will probably override this behavior by defining my own __eq__, etc., in my derived class, just for safety. ** Bill Spotz ** ** Sandia National Laboratories Voice: (505)845-0170 ** ** P.O. Box 5800 Fax: (505)284-5451 ** ** Albuquerque, NM 87185-0370 Email: wf...@sa... ** |
From: Robert K. <rob...@gm...> - 2006-09-03 02:37:24
|
Charles R Harris wrote: > Hi all, > > I added the keyword side to the searchsorted method and functions. Thank you! Just the other day, I was wishing that we had such a thing. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco |
From: Charles R H. <cha...@gm...> - 2006-09-03 02:26:45
|
Hi all, I added the keyword side to the searchsorted method and functions. Documentation: """a.searchsorted(values=v, side='left') -> array of indices. Required Arguments: v -- keys to be searched for in a. Keyword arguments side -- {'left', 'right'}, default('left'). If a is a 1-D array in ascending order, then a.searchsorted(v, side='left') returns an array of indices i such that for each element of values the following holds: a[j] < key <= a[i] for all j < i, If such an index does not exist, a.size() is used. The result is such that if the key were to be inserted in the slot before the index i, then the order of a would be preserved and i would be the smallest index with that property. If a is a 1-D array in ascending order, then a.searchsorted(v, side='right') returns an array of indices i such that for each element of values the following holds: a[j] <= key < a[i] for all j < i, If such an index does not exist, a.size() is used. The result is that if the key were to be inserted in the slot before the index i, then the order of a would be preserved and i would be the largest index with that property. """ I also replaced the old search routine as it was linear time worst case: In [27]: t1 = t.Timer('N.searchsorted(a,1,side="left")','import numpy as N; a = N.ones(1000000)') In [28]: t2 = t.Timer('N.searchsorted(a,1,side="right")','import numpy as N; a = N.ones(1000000)') In [29]: t1.repeat(3,100) Out[29]: [0.5301368236541748, 0.4924161434173584, 0.46317386627197266] In [30]: t2.repeat(3,100) Out[30]: [0.0011379718780517578, 0.00081586837768554688, 0.00083994865417480469] where left was the original routine. It is now noticeably faster in some situations: In [2]: t1 = t.Timer('N.searchsorted(a,1,side="left")','import numpy as N; a = N.ones(1000000)') In [3]: t1.repeat(3,100) Out[3]: [0.00082802772521972656, 0.00077795982360839844, 0.00076913833618164062] I am open to suggestions as to better names for the keyword kind. It also might be worth it to make type-specific routines if anyone commonly uses large lists of keys and large sorted arrays. Chuck |
From: Guendolen H. <em...@fi...> - 2006-09-02 00:19:01
|
Hi =20 All yo e ur PHA o RRMAC s Y d f irec g tly from the m t anufa a cture j r, Your ch v an b ce to eco i nomiz v e wit o h us http://omgandesunkerion.com r=20 z=20 y=20 floor was smooth and hard, as were the walls when I brushed my fingers What about her? Steengo asked. be a crackup in the old kaserne tonight! |
From: David M. C. <co...@ph...> - 2006-08-31 23:12:53
|
On Aug 30, 2006, at 11:53 , Keith Goodman wrote: > I plan to build an amd64 box and run debian etch. Are there any big, > 64-bit, show-stopping problems in numpy? Any minor annoyances? Shouldn't be; I regularly build and test it on an amd64 box running Debian unstable, and I know several others use amd64 boxes too. -- |>|\/|< /------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |co...@ph... |
From: <hj...@to...> - 2006-08-31 20:27:37
|
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> <style type="text/css"> <!-- .td { font-size: 12px; color: #313131; line-height: 20px; font-family: "Arial", "Helvetica", "sans-serif"; } --> </style> </head> <body leftmargin="0" background="http://bo.sohu.com//images/img20040502/dj_bg.gif"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="31" background="http://igame.sina.com.cn/club/images/topmenu/topMenu_8.gif" class="td"><div align="center"><font color="#FFFFFF">主办单位:易腾企业管理咨询有限公司</font></div></td> </tr> </table> <br> <table width="684" border="0" align="center" cellpadding="0" cellspacing="0" height="1171"> <tr> <td height="71" bgcolor="#8C8C8C"> <div align="center"> <table width="100%" border="0" cellspacing="1" cellpadding="0" height="76"> <tr> <td height="74" bgcolor="#F3F3F3"><div align="center"> <span lang="zh-cn"><font size="6">运用EXCEL改进市场营销与财务管理</font></span></div></td> </tr> </table> </div></td> </tr> <tr> <td height="1095" bgcolor="#FFFFFF"> <div align="center"> <table width="99%" border="0" cellspacing="0" cellpadding="0" height="48"> <tr> <td width="17%" height="22" bgcolor="#BF0000" class="td"> <div align="center"><font color="#FFFFFF">[课 程 背 景]</font></div></td> <td width="83%" class="td" height="22"> </td> </tr> <tr> <td height="26" colspan="2" class="td"> <p ALIGN="JUSTIFY"><font LANG="ZH-CN"> <font size="2"> 不管您在什么岗位上工作,利用Excel电子表格进行数据分析几乎已经成为每个经理人的必备工具,无论您从事采购、销售、财务分析还是经营决策,电子表格能够帮助你筛选数据、分析数据并制作管理图表,Excel的各种财务函数为您进行本量利分析和经营决策提供了方便。如果你打算利用Excel提高工作质量和效率,运用Powerpoint制作优美的演示报告取得不同凡响的震撼效果,那么这个课程就是为你定制的。<br> <b>培 训 收 益:</b><br> 提高EXCEL和PPT实际操作能力,提高工作效率;<br> 掌握如何利用各种函数建立数学模型进行高效财务分析;<br> 掌握快速实现产品、客户分类的方法,使公司效益倍增;<br> 掌握建立多因素量本利敏感分析模型,使你直观地发现最佳盈利模式;<br> 掌握利用各种预测工具,寻找营销方案;<br> 掌握如何制作令老板满意的各类图表和管理报告。 </font> </font></td> </tr> </table> </div> <div align="center" style="width: 671; height: 1"> </div> <div align="center"> <table width="99%" height="84" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="17%" height="20" bgcolor="#0080C0" class="td"> <div align="center"><font color="#FFFFFF">[课 程 大 纲]</font></div></td> <td width="83%" class="td"> </td> </tr> <tr> <td height="64" colspan="2" class="td"> <p> <font size="2"><b>一、EXCEL和Powerpoint的操作技巧</b><br> 1 数据管理:<br> 数据格式、建立公式、数据编辑、图表制作、排序、筛选、分类汇总<br> 2 数据分析:<br> 数据透视表(图)、数据敏感分析、单变量求解、模拟运算表、规划求解<br> 3 不同类型报告的模版演示:<br> ①业绩报告;项目汇报、②财务报告、③动员与展望、④评审/评估报告<br> 4 图表应用的五个步骤:<br> 目标、主题、对比关系、数据、图表<br> 5 用PPT表达思想<br> 管理结构、工作流程、业绩趋势和分析、竞争对手的对比<br> 6 PPT与EXCEL,OUTLOOK的链接使用技巧<br> <br> <b>二、如何运用图表进行事务处理和工作报告</b><br> 怎样快速创建出你需要的图表<br> 如何创建动态图<br> 如何因地制宜地使用图表<br> 行政管理表格设计<br> 人力资源管理表格设计<br> 如何自动生成员工考核工资表<br> 企业销售业绩的图表表达<br> 产品市场占有率的图表表达<br> 如何运用EXCEL分析市场调查问卷<br> 如何运用EXCEL制作和分析销售报表<br> 如何运用EXCEL制作和分析财务报表<br> 人事、物料、财务数据库的链接和自动处理<br> <br> <b>三、如何运用EXCEL进行本量利分析和经营决策</b><br> 成本费用分析与管理<br> 销售业务管理与决策<br> 动态本量利模型分析<br> 固定资产折旧计算<br> 工资及个人所得税计算<br> 现金日报及现金流量表的编制<br> 由资产负债表自动生成现金流量表<br> 工资、固定资产投资、折旧方案筛选等实际运用模板建立和应用分析<br> 量本利分析、回归分析、方案预测、销售客户产品分析等实战演练<br> 定性指标的定量化分析技术应用的模拟演练<br> 运用数据透视表(图)进行经营分析的分析思路和模拟演练<br> 投资项目评价与决策<br> <br> <b>四、管理和经营报告</b><br> 用图片插入技术制作项目分析短片<br> 动画展示产品型号及功能<br> 市场分析及推广计划演示<br> 形象化的股东大会营运报告<br> 制作动感宣传片<br> 丰富多彩的可行性研究报告<br> <br> <b>五、案例分析和实例演练</b></font></p></td> </tr> </table> <table width="99%" height="84" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="17%" height="20" bgcolor="#0080C0" class="td"> <div align="center"><font color="#FFFFFF">[导 师 简 介]</font></div></td> <td width="83%" class="td"> </td> </tr> <tr> <td height="64" colspan="2" class="td"> <p> <font color="#FF0000"> </font><font size="2">Mr Wang ,管理工程硕士、高级经济师,国际职业培训师协会认证职业培训师,历任跨国公司工业工程经理、管理会计分析师、营运总监等高级管理职务多年,同时还担任 < 价值工程 > 杂志审稿人、辽宁省营口市商业银行独立董事等职务,对企业管理有较深入的研究。 王老师主要从事成本控制、财务管理、管理会计决策等课程的讲授,为 IBM 、 TDK 、松下、可口可乐、康师傅、汇源果汁、雪津啤酒、吉百利食品、冠捷电子、 INTEX 明达塑胶、正新橡胶、美国 ITT 集团、广上科技、美的空调、中兴通讯、京信通信、联想电脑,应用材料 ( 中国 ) 公司、艾克森 - 金山石化、中国化工进出口公司、正大集团大福饲料、厦华集团、灿坤股份、NEC 东金电子、太原钢铁集团、 PHILIPS 、深圳开发科技、大冷王运输制冷、三洋华强、 TCL 、美的汽车、上海贝尔阿尔卡特、天津扎努西、上海卡博特等知名企业提供项目辅导或专题培训。王老师授课经验丰富,风格幽默诙谐、逻辑清晰、过程互动,案例生动、深受学员喜爱。</font></p></td> </tr> </table> </div> <div align="center"> <table width="679" border="0" cellpadding="0" cellspacing="0" height="70"> <tr> <td width="132" height="24" bgcolor="#0080C0" class="td"> <div align="center"><font color="#FFFFFF">[时间/地点/联系方式]</font></div></td> <td width="546" class="td" height="24"> </td> </tr> <tr> <td height="46" colspan="2" class="td" width="679"> <p><font size="2"><b>时间:</b> 9月9-10日 (周六/日) 上海 1980/人<font face="宋体">(含课程费、教材、午餐等)</font> 四人以上参加,赠予一名名额</font></p> </td> </tr> </table> </div> <table width="99%" height="45" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="25" class="td"> <font size="2"><b>报名/咨询:</b><font color="#000000"> </font>谢小姐 <font color="#000000">021-51187126</font><br> 注:如您不需要此邮件,请发送邮件至:ee...@12... 并在标题注明订退</font></td> </tr> </table> </td> </tr> </table> </body> </html> |
From: Charles R H. <cha...@gm...> - 2006-08-31 19:59:44
|
On 8/31/06, Christopher Barker <Chr...@no...> wrote: > > Tom Denniston wrote: > > I would think one would want to throw an error when the data has > > inconsistent dimensions. > > But it doesn't have inconsistent dimensions - they are perfectly > consistent with a (2,) array of objects. How is the code to know what > you intended? Same as it produces a float array from array([1,2,3.0]). Array is a complicated function for precisely these sort of reasons, but the convenience makes it worthwhile. So, if a list contains something that can only be interpreted as an object, dtype should be set to object. With numeric types, it is unambiguous to march down through the > sequences until you get a number. As a sequence is an object, there no > way to unambiguously do this automatically. > > Perhaps the way to solve this is for the array constructor to take a > "shape" or "rank" argument, so you could specify what you intend. But > that's really just syntactic sugar to avoid for calling numpy.empty() > first. > > Perhaps a numpy.object_array() constructor would be useful, although as > I think about it, even specifying a shape or rank would not be > unambiguous! > > This is a useful discussion. If we ever get a nd-array into the standard > lib, I suspect that object arrays will get heavy use -- better to clean > up the semantics now. > > Perhaps a Wiki page on building object arrays is called for. > > -Chris Chuck |
From: Christopher B. <Chr...@no...> - 2006-08-31 19:51:18
|
Tom Denniston wrote: > I would think one would want to throw an error when the data has > inconsistent dimensions. But it doesn't have inconsistent dimensions - they are perfectly consistent with a (2,) array of objects. How is the code to know what you intended? With numeric types, it is unambiguous to march down through the sequences until you get a number. As a sequence is an object, there no way to unambiguously do this automatically. Perhaps the way to solve this is for the array constructor to take a "shape" or "rank" argument, so you could specify what you intend. But that's really just syntactic sugar to avoid for calling numpy.empty() first. Perhaps a numpy.object_array() constructor would be useful, although as I think about it, even specifying a shape or rank would not be unambiguous! This is a useful discussion. If we ever get a nd-array into the standard lib, I suspect that object arrays will get heavy use -- better to clean up the semantics now. Perhaps a Wiki page on building object arrays is called for. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
From: Tom D. <tom...@al...> - 2006-08-31 19:29:19
|
I would think one would want to throw an error when the data has inconsistent dimensions. This is what numpy does for other dtypes: In [10]: numpy.array(([1,2,3], [4,5,6])) Out[10]: array([[1, 2, 3], [4, 5, 6]]) In [11]: numpy.array(([1,3], [4,5,6])) --------------------------------------------------------------------------- exceptions.TypeError Traceback (most recent call last) TypeError: an integer is required On 8/31/06, Christopher Barker <Chr...@no...> wrote: > > Tom Denniston wrote: > > So my question is what is the _advantage_ of the new semantics? > > what if the list don't have the same length, and therefor can not be > made into an array, now you get a weird result: > > >>>N.array([N.array([1,'A',None],dtype=object),N.array > ([2,2,'Somestring',5],dtype=object)]).shape > () > > Now you get an Object scalar. > > but: > >>>N.array([N.array([1,'A',None],dtype=object),N.array > ([2,2,'Somestring',5],dtype=object)],dtype=object).shape > (2,) > > Now you get a length 2 array, just like before: far more consistent. > With the old semantics, if you test your code with arrays of different > lengths, you'll get one thing, but if they then happen to be the same > length in some production use, the whole thing breaks -- this is a Bad > Idea. > > Object arrays are just plain weird, there is nothing you can do that > will satisfy every need. I think it's best for the array constructor to > not try to guess at what the hierarchy of sequences you *meant* to use. > You can (and probably should) always be explicit with: > > >>> A = N.empty((2,), dtype=object) > >>> A > array([None, None], dtype=object) > >>> A[:] = [N.array([1,'A', None], > dtype=object),N.array([2,2,'Somestring',5],dtype=object)] > >>> A > array([[1 A None], [2 2 Somestring 5]], dtype=object) > > -Chris > > > > > > -- > Christopher Barker, Ph.D. > Oceanographer > > NOAA/OR&R/HAZMAT (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > Chr...@no... > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > |
From: Christopher B. <Chr...@no...> - 2006-08-31 19:09:00
|
Tom Denniston wrote: > So my question is what is the _advantage_ of the new semantics? what if the list don't have the same length, and therefor can not be made into an array, now you get a weird result: >>>N.array([N.array([1,'A',None],dtype=object),N.array([2,2,'Somestring',5],dtype=object)]).shape () Now you get an Object scalar. but: >>>N.array([N.array([1,'A',None],dtype=object),N.array([2,2,'Somestring',5],dtype=object)],dtype=object).shape (2,) Now you get a length 2 array, just like before: far more consistent. With the old semantics, if you test your code with arrays of different lengths, you'll get one thing, but if they then happen to be the same length in some production use, the whole thing breaks -- this is a Bad Idea. Object arrays are just plain weird, there is nothing you can do that will satisfy every need. I think it's best for the array constructor to not try to guess at what the hierarchy of sequences you *meant* to use. You can (and probably should) always be explicit with: >>> A = N.empty((2,), dtype=object) >>> A array([None, None], dtype=object) >>> A[:] = [N.array([1,'A', None], dtype=object),N.array([2,2,'Somestring',5],dtype=object)] >>> A array([[1 A None], [2 2 Somestring 5]], dtype=object) -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
From: Christopher B. <Chr...@no...> - 2006-08-31 18:51:50
|
Tim Hochberg wrote: >> That's what I'd expect, but what if you start with a (0,) array: >> >>> a = N.array([]).sum(); a.shape; a.size; a >> () >> 1 >> 0 >> >> where did that zero come from? >> > More or less from: > > >>> numpy.add.identity > 0 I'm not totally sure, but I think I'd rather it raise an exception. However, if it's not going to, then 0 is really the only reasonable answer. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
From: Tim H. <tim...@ie...> - 2006-08-31 18:43:41
|
Torgil Svensson wrote: >> Yes. fromiter(iterable, dtype, count) works. >> > > Oh. Thanks. I probably had too old documentation to see this (15 > June). If it's not updated since I'll give Travis a rest about this, > at least until 1.0 is released :) > Actually I just knew 'cause I wrote it. I don't see a docstring for fromiter, although I though I wrote one. Maybe I just forgot? >> Regardless, L is only iterated over once. >> > > How can this be true? If no size is given, mustn't numpy either loop > over L twice or build an internal representation on which it'll > iterate or copy in chunks? > Well, it can't in general loop over L twice since the only method that L is guaranteed to have is next(); that's the extent of the iterator protocol. What it does is allocate an initial chunk of memory (the size of which I forget -- I did some tuning) and start filling it up. Once it's full, it does a realloc, which expands the existing chunk or memory, if possible, or returns a new, larger, chunk of memory with the data copied into it. Then we iterate on L some more until we fill up the new larger chunk, in which case we go get another one, etc. This is exactly how list.append works, although in that case the chunk of data is acutally a chunk of pointers to objects. -tim > > I just found out that this works > >>>> import numpy,itertools >>>> rec_dt=numpy.dtype(">i4,S10,f8") >>>> rec_iter=itertools.cycle([(1,'s',4.0),(5,'y',190.0),(2,'h',-8)]) >>>> numpy.fromiter(rec_iter,rec_dt,10).view(recarray) >>>> > recarray([(1, 's', 4.0), (5, 'y', 190.0), (2, 'h', -8.0), (1, 's', 4.0), > (5, 'y', 190.0), (2, 'h', -8.0), (1, 's', 4.0), (5, 'y', 190.0), > (2, 'h', -8.0), (1, 's', 4.0)], > dtype=[('f0', '>i4'), ('f1', '|S10'), ('f2', '<f8')]) > > but what's wrong with this? > > >>>> d2_dt=numpy.dtype("4f8") >>>> d2_iter=itertools.cycle([(1.0,numpy.nan,-1e10,14.0)]) >>>> numpy.fromiter(d2_iter,d2_dt,10) >>>> > Traceback (most recent call last): > File "<stdin>", line 1, in ? > TypeError: a float is required > >>>> numpy.__version__ >>>> > '1.0b4' > > //Torgil > > > > On 8/30/06, Tim Hochberg <tim...@ie...> wrote: > >> Torgil Svensson wrote: >> >>>> return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int)) >>>> >>>> >>> Is it possible for fromiter to take an optional shape (or count) >>> argument in addition to the dtype argument? >>> >> Yes. fromiter(iterable, dtype, count) works. >> >> >>> If both is given it could >>> preallocate memory and we only have to iterate over L once. >>> >>> >> Regardless, L is only iterated over once. In general you can't rewind >> iterators, so that's a requirement. This is accomplished by doing >> successive overallocation similar to the way appending to a list is >> handled. By specifying the count up front you save a bunch of reallocs, >> but no iteration. >> >> -tim >> >> >> >> >>> //Torgil >>> >>> On 8/29/06, Keith Goodman <kwg...@gm...> wrote: >>> >>> >>>> On 8/29/06, Torgil Svensson <tor...@gm...> wrote: >>>> >>>> >>>>> something like this? >>>>> >>>>> def list2index(L): >>>>> uL=sorted(set(L)) >>>>> idx=dict((y,x) for x,y in enumerate(uL)) >>>>> return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int)) >>>>> >>>>> >>>> Wow. That's amazing. Thank you. >>>> >>>> ------------------------------------------------------------------------- >>>> Using Tomcat but need to do more? Need to support web services, security? >>>> Get stuff done quickly with pre-integrated technology to make your job easier >>>> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >>>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>>> _______________________________________________ >>>> Numpy-discussion mailing list >>>> Num...@li... >>>> https://lists.sourceforge.net/lists/listinfo/numpy-discussion >>>> >>>> >>>> >>> ------------------------------------------------------------------------- >>> Using Tomcat but need to do more? Need to support web services, security? >>> Get stuff done quickly with pre-integrated technology to make your job easier >>> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>> _______________________________________________ >>> Numpy-discussion mailing list >>> Num...@li... >>> https://lists.sourceforge.net/lists/listinfo/numpy-discussion >>> >>> >>> >>> >> >> ------------------------------------------------------------------------- >> Using Tomcat but need to do more? Need to support web services, security? >> Get stuff done quickly with pre-integrated technology to make your job easier >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> _______________________________________________ >> Numpy-discussion mailing list >> Num...@li... >> https://lists.sourceforge.net/lists/listinfo/numpy-discussion >> >> > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > > > |
From: Robert K. <rob...@gm...> - 2006-08-31 18:35:58
|
Angelo Secchi wrote: > Hi, > I have the following script > > import fileinput > import string > from math import * > from scipy import * > from rpy import * > import Numeric > import shelve > import sys > > def dpolya1(n,N,b,a): > a=float(a) > b=float(b) > L=784 > probs=((special.gammaln(N+1)+special.gammaln(L*(a/b))+special.gammaln((a/b)+n)+special.gammaln((a/b)*(L-1)+N-n))-(special.gammaln(L*(a/b)+N)+special.gammaln(a/b)+special.gammaln(n+1)+special.gammaln(N-n+1)+special.gammaln(L*(a/b)-(a/b))))#) > return probs > > and I observe the following "strange" (for me of course) behaviour > >>>> dpolya1(1,2,0.5,0.4) > -5.9741312822170585 >>>> type(dpolya1(1,2,0.5,0.4)) > <type 'float64scalar'> >>>> exp(dpolya1(1,2,0.5,0.4)) > Traceback (most recent call last): > File "<stdin>", line 1, in ? > AttributeError: 'numpy.ndarray' object has no attribute 'exp' > > I do not understand what's wrong. Any help? Probably rpy (which still uses Numeric, right?) is exposing Numeric's exp() implementation and overriding the one that you got from scipy (which is numpy's, I presume). When Numeric's exp() is confronted with an object that it doesn't recognize, it looks for a .exp() method to call. If you want to avoid this situation in the future, don't use the "from foo import *" form. It makes debugging problems like this difficult. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco |
From: Charles R H. <cha...@gm...> - 2006-08-31 18:35:29
|
I submitted a ticket for this. On 8/31/06, Tom Denniston <tom...@al...> wrote: > > wrote the last email before reading your a = array([1,'A', None]) > comment. I definately agree with you on that. > > > On 8/31/06, Tom Denniston <tom...@al...> wrote: > > > > Yes one can take a toy example and hack it to work but I don't > > necessarily have control over the input as to whether it is a list of object > > arrays, list of 1d heterogenous arrays, etc. Before I didn't need to worry > > about the input because numpy understood that a list of 1d arrays is a > > 2d piece of data. Now it understands this for all dtypes except object. My > > question was is this new set of semantics preferable to the old. > > > > I think your example kind of proves my point. Does it really make any > > sense for the following two ways of specifying an array give such different > > results? They strike me as _meaning_ the same thing. Doesn't it seem > > inconsistent to you? > > > > > > In [13]: array([array([1,'A', None], dtype=object),array([2,2,'Some > > string'],dtype=object)], dtype=object).shape > > Out[13]: (2,) > > > > and > > > > In [14]: array([array([1,'A', None], dtype=object),array([2,2,'Some > > string'],dtype=object)]).shape > > Out[14]: (2, 3) > > So my question is what is the _advantage_ of the new semantics? The two > > examples above used to give the same results. In what cases is it > > preferable for them to give different results? How does it make life > > simpler? > > > > > > On 8/31/06, Charles R Harris <cha...@gm... > wrote: > > > > > On 8/31/06, Tom Denniston <tom...@al... > wrote: > > > > > But i have hetergenious arrays that have numbers and strings and > > > NoneType, etc. > > > > > > Take for instance: > > > > > > In [11]: numpy.array([numpy.array([1,'A', None]), > > > numpy.array([2,2,'Some string'])], dtype=object) > > > Out[11]: > > > array([[1, A, None], > > > [2, 2, Some string]], dtype=object) > > > > > > In [12]: numpy.array([ numpy.array([1,'A', None]), > > > numpy.array([2,2,'Some string'])], dtype=object).shape > > > Out[12]: (2, 3) > > > > > > Works fine in Numeric and pre beta numpy but in beta numpy versions i > > > get: > > > > > > I think you want: > > > > In [59]: a = array([array([1,'A', None],dtype=object),array([2,2,'Some > > string'],dtype=object)]) > > > > In [60]: a.shape > > Out[60]: (2, 3) > > > > > > Which makes good sense to me. > > > > Chuck > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, > > security? > > Get stuff done quickly with pre-integrated technology to make your job > > easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > > Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > _______________________________________________ > > Numpy-discussion mailing list > > Num...@li... > > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > > > > > > > > > > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > > > |
From: Torgil S. <tor...@gm...> - 2006-08-31 18:25:15
|
def list2index(L): uL=sorted(set(L)) idx=dict((y,x) for x,y in enumerate(uL)) return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int,count=len(L))) adding the count will save you a little more time, and temporary memory [see related thread]. //Torgil On 8/29/06, Keith Goodman <kwg...@gm...> wrote: > On 8/29/06, Torgil Svensson <tor...@gm...> wrote: > > something like this? > > > > def list2index(L): > > uL=sorted(set(L)) > > idx=dict((y,x) for x,y in enumerate(uL)) > > return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int)) > > Wow. That's amazing. Thank you. > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > |
From: Torgil S. <tor...@gm...> - 2006-08-31 18:21:54
|
> Yes. fromiter(iterable, dtype, count) works. Oh. Thanks. I probably had too old documentation to see this (15 June). If it's not updated since I'll give Travis a rest about this, at least until 1.0 is released :) > Regardless, L is only iterated over once. How can this be true? If no size is given, mustn't numpy either loop over L twice or build an internal representation on which it'll iterate or copy in chunks? I just found out that this works >>> import numpy,itertools >>> rec_dt=numpy.dtype(">i4,S10,f8") >>> rec_iter=itertools.cycle([(1,'s',4.0),(5,'y',190.0),(2,'h',-8)]) >>> numpy.fromiter(rec_iter,rec_dt,10).view(recarray) recarray([(1, 's', 4.0), (5, 'y', 190.0), (2, 'h', -8.0), (1, 's', 4.0), (5, 'y', 190.0), (2, 'h', -8.0), (1, 's', 4.0), (5, 'y', 190.0), (2, 'h', -8.0), (1, 's', 4.0)], dtype=[('f0', '>i4'), ('f1', '|S10'), ('f2', '<f8')]) but what's wrong with this? >>> d2_dt=numpy.dtype("4f8") >>> d2_iter=itertools.cycle([(1.0,numpy.nan,-1e10,14.0)]) >>> numpy.fromiter(d2_iter,d2_dt,10) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: a float is required >>> numpy.__version__ '1.0b4' //Torgil On 8/30/06, Tim Hochberg <tim...@ie...> wrote: > Torgil Svensson wrote: > >> return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int)) > >> > > > > Is it possible for fromiter to take an optional shape (or count) > > argument in addition to the dtype argument? > Yes. fromiter(iterable, dtype, count) works. > > > If both is given it could > > preallocate memory and we only have to iterate over L once. > > > Regardless, L is only iterated over once. In general you can't rewind > iterators, so that's a requirement. This is accomplished by doing > successive overallocation similar to the way appending to a list is > handled. By specifying the count up front you save a bunch of reallocs, > but no iteration. > > -tim > > > > > //Torgil > > > > On 8/29/06, Keith Goodman <kwg...@gm...> wrote: > > > >> On 8/29/06, Torgil Svensson <tor...@gm...> wrote: > >> > >>> something like this? > >>> > >>> def list2index(L): > >>> uL=sorted(set(L)) > >>> idx=dict((y,x) for x,y in enumerate(uL)) > >>> return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int)) > >>> > >> Wow. That's amazing. Thank you. > >> > >> ------------------------------------------------------------------------- > >> Using Tomcat but need to do more? Need to support web services, security? > >> Get stuff done quickly with pre-integrated technology to make your job easier > >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > >> _______________________________________________ > >> Numpy-discussion mailing list > >> Num...@li... > >> https://lists.sourceforge.net/lists/listinfo/numpy-discussion > >> > >> > > > > ------------------------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, security? > > Get stuff done quickly with pre-integrated technology to make your job easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > > Numpy-discussion mailing list > > Num...@li... > > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > > > > > > > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > |
From: Angelo S. <se...@ss...> - 2006-08-31 18:13:47
|
Hi, I have the following script import fileinput import string from math import * from scipy import * from rpy import * import Numeric import shelve import sys def dpolya1(n,N,b,a): a=float(a) b=float(b) L=784 probs=((special.gammaln(N+1)+special.gammaln(L*(a/b))+special.gammaln((a/b)+n)+special.gammaln((a/b)*(L-1)+N-n))-(special.gammaln(L*(a/b)+N)+special.gammaln(a/b)+special.gammaln(n+1)+special.gammaln(N-n+1)+special.gammaln(L*(a/b)-(a/b))))#) return probs and I observe the following "strange" (for me of course) behaviour >>> dpolya1(1,2,0.5,0.4) -5.9741312822170585 >>> type(dpolya1(1,2,0.5,0.4)) <type 'float64scalar'> >>> exp(dpolya1(1,2,0.5,0.4)) Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: 'numpy.ndarray' object has no attribute 'exp' I do not understand what's wrong. Any help? Thanks Angelo |
From: Tom D. <tom...@al...> - 2006-08-31 18:11:31
|
wrote the last email before reading your a = array([1,'A', None]) comment. I definately agree with you on that. On 8/31/06, Tom Denniston <tom...@al...> wrote: > > Yes one can take a toy example and hack it to work but I don't > necessarily have control over the input as to whether it is a list of object > arrays, list of 1d heterogenous arrays, etc. Before I didn't need to worry > about the input because numpy understood that a list of 1d arrays is a > 2d piece of data. Now it understands this for all dtypes except object. My > question was is this new set of semantics preferable to the old. > > I think your example kind of proves my point. Does it really make any > sense for the following two ways of specifying an array give such different > results? They strike me as _meaning_ the same thing. Doesn't it seem > inconsistent to you? > > > In [13]: array([array([1,'A', None], dtype=object),array([2,2,'Some > string'],dtype=object)], dtype=object).shape > Out[13]: (2,) > > and > > In [14]: array([array([1,'A', None], dtype=object),array([2,2,'Some > string'],dtype=object)]).shape > Out[14]: (2, 3) > So my question is what is the _advantage_ of the new semantics? The two > examples above used to give the same results. In what cases is it > preferable for them to give different results? How does it make life > simpler? > > > On 8/31/06, Charles R Harris <cha...@gm...> wrote: > > > On 8/31/06, Tom Denniston <tom...@al... > wrote: > > > But i have hetergenious arrays that have numbers and strings and > > NoneType, etc. > > > > Take for instance: > > > > In [11]: numpy.array([numpy.array([1,'A', None]), > > numpy.array([2,2,'Some string'])], dtype=object) > > Out[11]: > > array([[1, A, None], > > [2, 2, Some string]], dtype=object) > > > > In [12]: numpy.array([ numpy.array([1,'A', None]), > > numpy.array([2,2,'Some string'])], dtype=object).shape > > Out[12]: (2, 3) > > > > Works fine in Numeric and pre beta numpy but in beta numpy versions i > > get: > > > I think you want: > > In [59]: a = array([array([1,'A', None],dtype=object),array([2,2,'Some > string'],dtype=object)]) > > In [60]: a.shape > Out[60]: (2, 3) > > > Which makes good sense to me. > > Chuck > > > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > > > > > |