MCPcopy Index your code
hub / github.com/plotly/plotly.py / encode_as_pandas

Method encode_as_pandas

_plotly_utils/utils.py:271–284  ·  view source on GitHub ↗

Attempt to convert pandas.NaT / pandas.NA

(obj)

Source from the content-addressed store, hash-verified

269
270 @staticmethod
271 def encode_as_pandas(obj):
272 """Attempt to convert pandas.NaT / pandas.NA"""
273 pandas = get_module("pandas", should_load=False)
274 if not pandas:
275 raise NotEncodable
276
277 if obj is pandas.NaT:
278 return None
279
280 # pandas.NA was introduced in pandas 1.0
281 if hasattr(pandas, "NA") and obj is pandas.NA:
282 return None
283
284 raise NotEncodable
285
286 @staticmethod
287 def encode_as_numpy(obj):

Callers 1

test_encode_as_pandasMethod · 0.80

Calls 1

get_moduleFunction · 0.90

Tested by 1

test_encode_as_pandasMethod · 0.64