MCPcopy Create free account
hub / github.com/apache/arrow / InitPandasStaticData

Function InitPandasStaticData

python/pyarrow/src/arrow/python/helpers.cc:397–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395} // namespace
396
397void InitPandasStaticData() {
398 pandas_runner.RunOnce([](OwnedRef& module) {
399 OwnedRef ref;
400
401 // set NaT sentinel and its type
402 if (ImportFromModule(module.obj(), "NaT", &ref).ok()) {
403 pandas_NaT = ref.obj();
404 // PyObject_Type returns a new reference but we trust that pandas.NaT will
405 // outlive our use of this PyObject*
406 pandas_NaTType = Py_TYPE(ref.obj());
407 }
408
409 // retain a reference to Timedelta
410 if (ImportFromModule(module.obj(), "Timedelta", &ref).ok()) {
411 pandas_Timedelta = ref.obj();
412 }
413
414 // retain a reference to Timestamp
415 if (ImportFromModule(module.obj(), "Timestamp", &ref).ok()) {
416 pandas_Timestamp = ref.obj();
417 }
418
419 // if pandas.NA exists, retain a reference to it
420 if (ImportFromModule(module.obj(), "NA", &ref).ok()) {
421 pandas_NA = ref.obj();
422 }
423
424 // Import DateOffset type
425 if (ImportFromModule(module.obj(), "DateOffset", &ref).ok()) {
426 pandas_DateOffset = ref.obj();
427 }
428 });
429}
430
431bool PandasObjectIsNull(PyObject* obj) {
432 if (!MayHaveNaN(obj)) {

Callers 3

InferArrowTypeFunction · 0.85
PandasWriterMethod · 0.85

Calls 3

ImportFromModuleFunction · 0.85
RunOnceMethod · 0.80
okMethod · 0.45

Tested by

no test coverage detected