We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b5c4ce2 commit f673026Copy full SHA for f673026
packages/python/plotly/_plotly_utils/utils.py
@@ -167,15 +167,19 @@ def encode_as_sage(obj):
167
168
@staticmethod
169
def encode_as_pandas(obj):
170
- """Attempt to convert pandas.NaT"""
+ """Attempt to convert pandas.NaT / pandas.NA"""
171
pandas = get_module("pandas", should_load=False)
172
if not pandas:
173
raise NotEncodable
174
175
if obj is pandas.NaT:
176
return None
177
- else:
178
- raise NotEncodable
+
+ # pandas.NA was introduced in pandas 1.0
179
+ if hasattr(pandas, "NA") and obj is pandas.NA:
180
+ return None
181
182
+ raise NotEncodable
183
184
185
def encode_as_numpy(obj):
0 commit comments