Returns a new Datasheet from a selective list of row and/or column indices.
(self, rows=ALL, columns=ALL)
| 1858 | return Datasheet(rows=[list.__getitem__(self, i)[j:j+m] for i in range(i, i+n)]) |
| 1859 | |
| 1860 | def copy(self, rows=ALL, columns=ALL): |
| 1861 | """ Returns a new Datasheet from a selective list of row and/or column indices. |
| 1862 | """ |
| 1863 | if rows == ALL and columns == ALL: |
| 1864 | return Datasheet(rows=self) |
| 1865 | if rows == ALL: |
| 1866 | return Datasheet(rows=zip(*(self.columns[j] for j in columns))) |
| 1867 | if columns == ALL: |
| 1868 | return Datasheet(rows=(self.rows[i] for i in rows)) |
| 1869 | z = zip(*(self.columns[j] for j in columns)) |
| 1870 | return Datasheet(rows=(z[i] for i in rows)) |
| 1871 | |
| 1872 | @property |
| 1873 | def json(self): |