8
8
9
9
class DataFrame :
10
10
11
- def get_column_by_name (self , key : str ) -> Column :
11
+ def get_column_by_name (self , name : str ) -> Column :
12
12
"""
13
13
Select a column by name.
14
14
15
15
Parameters
16
16
----------
17
- key : str
17
+ name : str
18
18
19
19
Returns
20
20
-------
@@ -27,13 +27,13 @@ def get_column_by_name(self, key: str) -> Column:
27
27
"""
28
28
...
29
29
30
- def get_columns_by_name (self , keys : Sequence [str ]) -> DataFrame :
30
+ def get_columns_by_name (self , names : Sequence [str ]) -> " DataFrame" :
31
31
"""
32
32
Select multiple columns by name.
33
33
34
34
Parameters
35
35
----------
36
- keys : Sequence[str]
36
+ names : Sequence[str]
37
37
38
38
Returns
39
39
-------
@@ -46,7 +46,7 @@ def get_columns_by_name(self, keys: Sequence[str]) -> DataFrame:
46
46
"""
47
47
...
48
48
49
- def get_rows (self , indices : Sequence [int ]) -> DataFrame :
49
+ def get_rows (self , indices : Sequence [int ]) -> " DataFrame" :
50
50
"""
51
51
Select a subset of rows, similar to `ndarray.take`.
52
52
@@ -62,13 +62,14 @@ def get_rows(self, indices: Sequence[int]) -> DataFrame:
62
62
Notes
63
63
-----
64
64
Some discussion participants prefer a stricter type Column[int] for
65
- indices.
65
+ indices in order to make it easier to implement in a performant manner
66
+ on GPUs.
66
67
"""
67
68
...
68
69
69
70
def slice_rows (
70
71
self , start : int | None , stop : int | None , step : int | None
71
- ) -> DataFrame :
72
+ ) -> " DataFrame" :
72
73
"""
73
74
Select a subset of rows corresponding to a slice.
74
75
@@ -84,7 +85,7 @@ def slice_rows(
84
85
"""
85
86
...
86
87
87
- def get_rows_by_mask (self , mask : Column [bool ]) -> DataFrame :
88
+ def get_rows_by_mask (self , mask : Column [bool ]) -> " DataFrame" :
88
89
"""
89
90
Select a subset of rows corresponding to a mask.
90
91
@@ -103,10 +104,21 @@ def get_rows_by_mask(self, mask: Column[bool]) -> DataFrame:
103
104
"""
104
105
...
105
106
106
- def insert (self , loc : int , label : str , value : Column ) -> DataFrame :
107
+ def insert (self , loc : int , label : str , value : Column ) -> "DataFrame" :
108
+ """
109
+ Insert column into DataFrame at specified location.
110
+
111
+ Parameters
112
+ ----------
113
+ loc : int
114
+ Insertion index. Must verify 0 <= loc <= len(columns).
115
+ label : str
116
+ Label of the inserted column.
117
+ value : Column
118
+ """
107
119
...
108
120
109
- def drop_column (self , label : str ) -> DataFrame :
121
+ def drop_column (self , label : str ) -> " DataFrame" :
110
122
"""
111
123
Drop the specified column.
112
124
@@ -125,7 +137,7 @@ def drop_column(self, label: str) -> DataFrame:
125
137
"""
126
138
...
127
139
128
- def set_column (self , label : str , value : Column ) -> DataFrame :
140
+ def set_column (self , label : str , value : Column ) -> " DataFrame" :
129
141
"""
130
142
Add or replace a column.
131
143
@@ -140,195 +152,209 @@ def set_column(self, label: str, value: Column) -> DataFrame:
140
152
"""
141
153
...
142
154
143
- def __eq__ (self , other : DataFrame | "Scalar" ) -> DataFrame :
155
+ def __eq__ (self , other : DataFrame | "Scalar" ) -> " DataFrame" :
144
156
"""
145
157
Parameters
146
158
----------
147
159
other : DataFrame or Scalar
148
160
If DataFrame, must have same length and matching columns.
149
- "Scalar" here is defined implicitly by the contained dtypes.
161
+ "Scalar" here is defined implicitly by what scalar types are allowed
162
+ for the operation by the underling dtypes.
150
163
151
164
Returns
152
165
-------
153
166
DataFrame
154
167
"""
155
168
...
156
169
157
- def __ne__ (self , other : DataFrame | "Scalar" ) -> DataFrame :
170
+ def __ne__ (self , other : DataFrame | "Scalar" ) -> " DataFrame" :
158
171
"""
159
172
Parameters
160
173
----------
161
174
other : DataFrame or Scalar
162
175
If DataFrame, must have same length and matching columns.
163
- "Scalar" here is defined implicitly by the contained dtypes.
176
+ "Scalar" here is defined implicitly by what scalar types are allowed
177
+ for the operation by the underling dtypes.
164
178
165
179
Returns
166
180
-------
167
181
DataFrame
168
182
"""
169
183
...
170
184
171
- def __ge__ (self , other : DataFrame | "Scalar" ) -> DataFrame :
185
+ def __ge__ (self , other : DataFrame | "Scalar" ) -> " DataFrame" :
172
186
"""
173
187
Parameters
174
188
----------
175
189
other : DataFrame or Scalar
176
190
If DataFrame, must have same length and matching columns.
177
- "Scalar" here is defined implicitly by the contained dtypes.
191
+ "Scalar" here is defined implicitly by what scalar types are allowed
192
+ for the operation by the underling dtypes.
178
193
179
194
Returns
180
195
-------
181
196
DataFrame
182
197
"""
183
198
...
184
199
185
- def __gt__ (self , other : DataFrame | "Scalar" ) -> DataFrame :
200
+ def __gt__ (self , other : DataFrame | "Scalar" ) -> " DataFrame" :
186
201
"""
187
202
Parameters
188
203
----------
189
204
other : DataFrame or Scalar
190
205
If DataFrame, must have same length and matching columns.
191
- "Scalar" here is defined implicitly by the contained dtypes.
206
+ "Scalar" here is defined implicitly by what scalar types are allowed
207
+ for the operation by the underling dtypes.
192
208
193
209
Returns
194
210
-------
195
211
DataFrame
196
212
"""
197
213
...
198
214
199
- def __le__ (self , other : DataFrame | "Scalar" ) -> DataFrame :
215
+ def __le__ (self , other : DataFrame | "Scalar" ) -> " DataFrame" :
200
216
"""
201
217
Parameters
202
218
----------
203
219
other : DataFrame or Scalar
204
220
If DataFrame, must have same length and matching columns.
205
- "Scalar" here is defined implicitly by the contained dtypes.
221
+ "Scalar" here is defined implicitly by what scalar types are allowed
222
+ for the operation by the underling dtypes.
206
223
207
224
Returns
208
225
-------
209
226
DataFrame
210
227
"""
211
228
...
212
229
213
- def __lt__ (self , other : DataFrame | "Scalar" ) -> DataFrame :
230
+ def __lt__ (self , other : DataFrame | "Scalar" ) -> " DataFrame" :
214
231
"""
215
232
Parameters
216
233
----------
217
234
other : DataFrame or Scalar
218
235
If DataFrame, must have same length and matching columns.
219
- "Scalar" here is defined implicitly by the contained dtypes.
236
+ "Scalar" here is defined implicitly by what scalar types are allowed
237
+ for the operation by the underling dtypes.
220
238
221
239
Returns
222
240
-------
223
241
DataFrame
224
242
"""
225
243
...
226
244
227
- def __add__ (self , other : DataFrame | "Scalar" ) -> DataFrame :
245
+ def __add__ (self , other : DataFrame | "Scalar" ) -> " DataFrame" :
228
246
"""
229
247
Parameters
230
248
----------
231
249
other : DataFrame or Scalar
232
250
If DataFrame, must have same length and matching columns.
233
- "Scalar" here is defined implicitly by the contained dtypes.
251
+ "Scalar" here is defined implicitly by what scalar types are allowed
252
+ for the operation by the underling dtypes.
234
253
235
254
Returns
236
255
-------
237
256
DataFrame
238
257
"""
239
258
...
240
259
241
- def __sub__ (self , other : DataFrame | "Scalar" ) -> DataFrame :
260
+ def __sub__ (self , other : DataFrame | "Scalar" ) -> " DataFrame" :
242
261
"""
243
262
Parameters
244
263
----------
245
264
other : DataFrame or Scalar
246
265
If DataFrame, must have same length and matching columns.
247
- "Scalar" here is defined implicitly by the contained dtypes.
266
+ "Scalar" here is defined implicitly by what scalar types are allowed
267
+ for the operation by the underling dtypes.
248
268
249
269
Returns
250
270
-------
251
271
DataFrame
252
272
"""
253
273
...
254
274
255
- def __mul__ (self , other : DataFrame | "Scalar" ) -> DataFrame :
275
+ def __mul__ (self , other : DataFrame | "Scalar" ) -> " DataFrame" :
256
276
"""
257
277
Parameters
258
278
----------
259
279
other : DataFrame or Scalar
260
280
If DataFrame, must have same length and matching columns.
261
- "Scalar" here is defined implicitly by the contained dtypes.
281
+ "Scalar" here is defined implicitly by what scalar types are allowed
282
+ for the operation by the underling dtypes.
262
283
263
284
Returns
264
285
-------
265
286
DataFrame
266
287
"""
267
288
...
268
289
269
- def __truediv__ (self , other : DataFrame | "Scalar" ) -> DataFrame :
290
+ def __truediv__ (self , other : DataFrame | "Scalar" ) -> " DataFrame" :
270
291
"""
271
292
Parameters
272
293
----------
273
294
other : DataFrame or Scalar
274
295
If DataFrame, must have same length and matching columns.
275
- "Scalar" here is defined implicitly by the contained dtypes.
296
+ "Scalar" here is defined implicitly by what scalar types are allowed
297
+ for the operation by the underling dtypes.
276
298
277
299
Returns
278
300
-------
279
301
DataFrame
280
302
"""
281
303
...
282
304
283
- def __floordiv__ (self , other : DataFrame | "Scalar" ) -> DataFrame :
305
+ def __floordiv__ (self , other : DataFrame | "Scalar" ) -> " DataFrame" :
284
306
"""
285
307
Parameters
286
308
----------
287
309
other : DataFrame or Scalar
288
310
If DataFrame, must have same length and matching columns.
289
- "Scalar" here is defined implicitly by the contained dtypes.
311
+ "Scalar" here is defined implicitly by what scalar types are allowed
312
+ for the operation by the underling dtypes.
290
313
291
314
Returns
292
315
-------
293
316
DataFrame
294
317
"""
295
318
...
296
319
297
- def __pow__ (self , other : DataFrame | "Scalar" ) -> DataFrame :
320
+ def __pow__ (self , other : DataFrame | "Scalar" ) -> " DataFrame" :
298
321
"""
299
322
Parameters
300
323
----------
301
324
other : DataFrame or Scalar
302
325
If DataFrame, must have same length and matching columns.
303
- "Scalar" here is defined implicitly by the contained dtypes.
326
+ "Scalar" here is defined implicitly by what scalar types are allowed
327
+ for the operation by the underling dtypes.
304
328
305
329
Returns
306
330
-------
307
331
DataFrame
308
332
"""
309
333
...
310
334
311
- def __mod__ (self , other : DataFrame | "Scalar" ) -> DataFrame :
335
+ def __mod__ (self , other : DataFrame | "Scalar" ) -> " DataFrame" :
312
336
"""
313
337
Parameters
314
338
----------
315
339
other : DataFrame or Scalar
316
340
If DataFrame, must have same length and matching columns.
317
- "Scalar" here is defined implicitly by the contained dtypes.
341
+ "Scalar" here is defined implicitly by what scalar types are allowed
342
+ for the operation by the underling dtypes.
318
343
319
344
Returns
320
345
-------
321
346
DataFrame
322
347
"""
323
348
...
324
349
325
- def __divmod__ (self , other : DataFrame | "Scalar" ) -> tuple [DataFrame , DataFrame ]:
350
+ def __divmod__ (self , other : DataFrame | "Scalar" ) -> tuple [" DataFrame" , " DataFrame" ]:
326
351
"""
327
352
Parameters
328
353
----------
329
354
other : DataFrame or Scalar
330
355
If DataFrame, must have same length and matching columns.
331
- "Scalar" here is defined implicitly by the contained dtypes.
356
+ "Scalar" here is defined implicitly by what scalar types are allowed
357
+ for the operation by the underling dtypes.
332
358
333
359
Returns
334
360
-------
0 commit comments