We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent df0f5d1 commit 2b05530Copy full SHA for 2b05530
1 file changed
datamatrix/_datamatrix/_where_index.py
@@ -0,0 +1,19 @@
1
+class WhereIndex(list):
2
+ """Primarily serves as a list-like object that is returned with where-like
3
+ operations:
4
+
5
+ where_index = dm[dm.col == 1]
6
7
+ However, for compariblity with dataframe, this list-like object should also
8
+ be able to provide access to columns, like so:
9
10
+ dm[dm.col == 1]['col'] = 2
11
+ """
12
+ def __init__(self, dm, values):
13
+ self._dm = dm
14
+ super().__init__(values)
15
16
+ def __getitem__(self, key):
17
+ if not isinstance(key, int):
18
+ return self._dm[key]
19
+ return key
0 commit comments