MCPcopy
hub / github.com/microsoft/qlib / write

Method write

qlib/data/storage/storage.py:299–352  ·  view source on GitHub ↗

Write data_array to FeatureStorage starting from index. Notes ------ If index is None, append data_array to feature. If len(data_array) == 0; return If (index - self.end_index) >= 1, self[end_index+1: index] will be filled with np.nan E

(self, data_array: Union[List, np.ndarray, Tuple], index: int = None)

Source from the content-addressed store, hash-verified

297 raise NotImplementedError("Subclass of FeatureStorage must implement `clear` method")
298
299 def write(self, data_array: Union[List, np.ndarray, Tuple], index: int = None):
300 """Write data_array to FeatureStorage starting from index.
301
302 Notes
303 ------
304 If index is None, append data_array to feature.
305
306 If len(data_array) == 0; return
307
308 If (index - self.end_index) >= 1, self[end_index+1: index] will be filled with np.nan
309
310 Examples
311 ---------
312 .. code-block::
313
314 feature:
315 3 4
316 4 5
317 5 6
318
319
320 >>> self.write([6, 7], index=6)
321
322 feature:
323 3 4
324 4 5
325 5 6
326 6 6
327 7 7
328
329 >>> self.write([8], index=9)
330
331 feature:
332 3 4
333 4 5
334 5 6
335 6 6
336 7 7
337 8 np.nan
338 9 8
339
340 >>> self.write([1, np.nan], index=3)
341
342 feature:
343 3 1
344 4 np.nan
345 5 6
346 6 6
347 7 7
348 8 np.nan
349 9 8
350
351 """
352 raise NotImplementedError("Subclass of FeatureStorage must implement `write` method")
353
354 def rebase(self, start_index: int = None, end_index: int = None):
355 """Rebase the start_index and end_index of the FeatureStorage.

Callers 15

rebaseMethod · 0.95
rewriteMethod · 0.95
_dump_pitMethod · 0.45
_parse_excelMethod · 0.45
get_new_companiesMethod · 0.45
create_envFunction · 0.45
executeFunction · 0.45
gen_and_save_md_tableFunction · 0.45
runMethod · 0.45
_collect_resultsMethod · 0.45
add_one_stock_daily_dataFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected