Commit feca1812d497a13238bfa25f93ffa43647003270
- Diff rendering mode:
- inline
- side by side
datamatrix/datamatrix.py
(13 / 0)
|   | |||
| 632 | 632 | ||
| 633 | 633 | return destination | |
| 634 | 634 | ||
| 635 | def subset(matrix, column_list): | ||
| 636 | |||
| 637 | """Creates a new matrix with only a subset of the columns present, as | ||
| 638 | specified by the columns_list parameter.""" | ||
| 639 | |||
| 640 | destination = EmptyMatrix(rownames=matrix.rownames, | ||
| 641 | identifier=matrix.identifier) | ||
| 642 | for column in column_list: | ||
| 643 | if column in matrix: | ||
| 644 | destination.append(matrix[column], column) | ||
| 645 | |||
| 646 | return destination | ||
| 647 | |||
| 635 | 648 | def _test(): | |
| 636 | 649 | import doctest | |
| 637 | 650 | doctest.testfile('../tutorial.txt') |

