I have a list of namedtuples named Books and am trying to increase the price field by 20% which does change the value of Books. I trie
This looks like a task for Python's data analysis library, pandas. It's really, really easy to do this sort of thing:
In [6]: import pandas as pd
In [7]: df = pd.DataFrame(BSI, columns=Book._fields)
In [8]: df
Out[8]:
author title genre year \
0 Suzane Collins The Hunger Games Fiction 2008
1 J.K. Rowling Harry Potter and the Sorcerers Stone Fantasy 1997
price instock
0 6.96 20
1 4.78 12
In [9]: df['price'] *= 100
In [10]: df
Out[10]:
author title genre year \
0 Suzane Collins The Hunger Games Fiction 2008
1 J.K. Rowling Harry Potter and the Sorcerer's Stone Fantasy 1997
price instock
0 696 20
1 478 12
Now isn't that just much, much better than labouring with namedtuples?