/usr/share/doc/pyspread/faq is in pyspread 0.2.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | pyspread FAQ
Q: What kind of expressions can cell contain?
A: A cell cannot contain statements such as
for i in xrange(10): pass
However, it can contain a list comprehension or a generator expression.
If you want to program more complex algorithms, use the Macro Editor.
There, you can define one (!) function at a time that uses arbitrary Python
code and is callable from any cell.
Example:
Type in the macro editor:
def factorize(number):
"""Silly factorizing algorithm for demonstration purposes only"""
counter = 1
result = []
while counter <= number:
if number % counter == 0:
result.append(counter)
counter += 1
return result
And in the cell:
factorize(25)
Result is:
[1 5 25]
Q: Is using the variable S the only way for reading values of a cell(s)?
A: The variable S is the very grid object. It can be used in various ways,
such as using its attributes and methods. One example is the spread method.
The object S has the attributes sgrid (string grid), fgrid (function grid),
macros (Macro dict) and resultcache and unredo (do not use these). There are
some method to access and manipulate the data. Since the attributes fgrid
and sgrid are numpy object grids, all numpy methods can be used directly.
When accessing (and slicing) S, you actually call a method that evaluates
S.fgrid. When you set an item in S, the sgrid item is set but it is not
automatically evaluated or updated. Have fun poking around in the S object.
Q: Is S.spread the only way to write to a cell using its absolute/relative
address?
A: Nope. However, it is the preferred way.
Try this out:
S[1,0,0] = '2'
Only after selecting the cell (1,0,0), the string 2 will appear and it will
be updated.
Note the error message in the original cell.
Q: How to write to cells from macro?
A: S.spread is your friend
Macro:
def test(a):
S.spread(a, (1, 0, 0))
Grid:
test(3)
Q: What are boundaries for the number of rows/columns/sheets?
A: Ultimately these are limited by your memory (and maybe your stack
restriction if any). Pyspread warns you about memory consumption if the grid
size is too large for a normal 2GB system. If you proceed you should be able
to create really large grids (especially on 64 bit machines with much RAM).
The maximum number of rows that I have tried out is 10 000 000.
However, pyspread does not use sparse grids due to performance issues.
If you really need larger grids, please contact me.
Q: I'd like to exact data from a saved .pys file it without using the GUI,
e.g. I'd like to open one in a script and read things from it.
A: The .pys format is a bzip2-ed pickle dump of the numpy object array that
contains the strings that are entered in the cells.
Example:
>>> import bz2
>>> infile=bz2.BZ2File('test.pys','r')
>>> import cPickle as pickle
>>> import numpy
>>> data = pickle.load(infile)
>>> data
array([[[rpy = __import__("rpy"), 1, ],
[, 3, ],
[, -4, ],
...,
[, , ],
[, , ],
[, , ]],
[[__import__("math"), 2, ],
[, 4, ],
[, 5, ],
...,
[, , ],
[, , ],
[, , ]],
[[a = numpy.arange(-1,1,.001), 3, ],
[, 35, ],
[, 2, ],
...,
[, , ],
[, , ],
[, , ]],
...,
[[, , ],
[, , ],
[, , ],
...,
[, , ],
[, , ],
[, , ]],
[[, , ],
[, , ],
[, , ],
...,
[, , ],
[, , ],
[, , ]],
[[, , ],
[, , ],
[, , ],
...,
[, , ],
[, , ],
[, , ]]], dtype=object)
>>> infile.close()
|