Re: Rounding off Values of dicts (in a list) to 2 decimal points

2013-10-03 Thread tripsvt
On Thursday, October 3, 2013 11:03:17 AM UTC-7, Neil Cerutti wrote: > On 2013-10-03, trip...@gmail.com wrote: > > > thekey=[{"a": 80.0, "b": 0.0, "c": 10.0, "d": 10.0}, {"a": > > > 100.0, "b": 0.0, "c": 0.0, "d": 0.0}, {"a": 80.0, "b": 0.0, > > > "c": 10.0, "d": 10.0}, {"a": 90.0, "b": 0.0, "c"

Re: Rounding off Values of dicts (in a list) to 2 decimal points

2013-10-03 Thread tripsvt
On Wednesday, October 2, 2013 10:01:16 AM UTC-7, tri...@gmail.com wrote: > am trying to round off values in a dict to 2 decimal points but have been > unsuccessful so far. The input I have is like this: > > > > > > y = [{'a': 80.0, 'b': 0.0786235, 'c': 10.0, 'd': 10.6742903}, {'a': > 80.

Rounding off Values of dicts (in a list) to 2 decimal points

2013-10-02 Thread tripsvt
am trying to round off values in a dict to 2 decimal points but have been unsuccessful so far. The input I have is like this: y = [{'a': 80.0, 'b': 0.0786235, 'c': 10.0, 'd': 10.6742903}, {'a': 80.73246, 'b': 0.0, 'c': 10.780323, 'd': 10.0}, {'a': 80.7239, 'b': 0.7823640, 'c': 10.0, 'd':

Convert namedtuple to dictionary

2013-09-25 Thread tripsvt
Need suggestions. Say, I have a namedtuple like this: {'a': brucelee(x=123, y=321), 'b': brucelee('x'=123, 'y'=321) I need to convert it to: {'a': {'x':123, 'y': 321},'b': {'x':123, 'y': 321}} Follow-up question -- Which would be easier to work with if I had to later extract/manipulate the