--
You received this message because you are subscribed to the Google Groups "Pyomo Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I agree with David’s first point (not so much with the second one he sneakily tried to sneak in)… I think it is better to keep floating point behavior for python data otherwise people will get burned. (OK fine… Carl will get burned.)
Incidentally, other python packages are not sold on the integer division either. While it is my understanding that numpy does truncated division with int by default, pandas does not.
>>> print(df)
A B
0 1 3
1 2 4
>>> df.div(2)
A B
0 0.5 1.5
1 1.0 2.0
>>>
Regards,
Carl.
--
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-develope...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyomo Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-develope...@googlegroups.com.
(The pandas code was done in Python 2.7)
I believe that this discussion was triggered by a discussion Bill and I am having on a PR. There are already a number of sneaky inconsistencies in Pyomo:
>>> m = ConcreteModel()
>>> m.p = Param(initialize=1)
>>> m.p / 2
0.5
>>> m.q = Param([1], initialize=1)
>>> m.q[1]/2
0
>>> m.r = Param(initialize=1, mutable=True)
>>> m.r/2
<pyomo.core.expr.expr_pyomo5.NPV_ProductExpression object at 0x7fc2362d9f30>
>>> value(m.r/2)
0.5
>>>
There is another one related to putting numpy floats into immutable indexed Params…
john