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

Function InitPandasStaticData

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

Source from the content-addressed store, hash-verified

372} // namespace
373
374void InitPandasStaticData() {
375 pandas_runner.RunOnce([](OwnedRef& module) {
376 OwnedRef ref;
377
378 // set NaT sentinel and its type
379 if (ImportFromModule(module.obj(), "NaT", &ref).ok()) {
380 pandas_NaT = ref.obj();
381 // PyObject_Type returns a new reference but we trust that pandas.NaT will
382 // outlive our use of this PyObject*
383 pandas_NaTType = Py_TYPE(ref.obj());
384 }
385
386 // retain a reference to Timedelta
387 if (ImportFromModule(module.obj(), "Timedelta", &ref).ok()) {
388 pandas_Timedelta = ref.obj();
389 }
390
391 // retain a reference to Timestamp
392 if (ImportFromModule(module.obj(), "Timestamp", &ref).ok()) {
393 pandas_Timestamp = ref.obj();
394 }
395
396 // if pandas.NA exists, retain a reference to it
397 if (ImportFromModule(module.obj(), "NA", &ref).ok()) {
398 pandas_NA = ref.obj();
399 }
400
401 // Import DateOffset type
402 if (ImportFromModule(module.obj(), "DateOffset", &ref).ok()) {
403 pandas_DateOffset = ref.obj();
404 }
405 });
406}
407
408bool PandasObjectIsNull(PyObject* obj) {
409 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