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

Function is_homogeneous_array

_plotly_utils/basevalidators.py:190–212  ·  view source on GitHub ↗

Return whether a value is considered to be a homogeneous array

(v)

Source from the content-addressed store, hash-verified

188
189
190def is_homogeneous_array(v):
191 """
192 Return whether a value is considered to be a homogeneous array
193 """
194 np = get_module("numpy", should_load=False)
195 pd = get_module("pandas", should_load=False)
196 if (
197 np
198 and isinstance(v, np.ndarray)
199 or (pd and isinstance(v, (pd.Series, pd.Index)))
200 or (isinstance(v, nw.Series))
201 ):
202 return True
203 if is_numpy_convertable(v):
204 np = get_module("numpy", should_load=True)
205 if np:
206 v_numpy = np.array(v)
207 # v is essentially a scalar and so shouldn't count as an array
208 if v_numpy.shape == ():
209 return False
210 else:
211 return True # v_numpy.dtype.kind in ["u", "i", "f", "M", "U"]
212 return False
213
214
215def is_simple_array(v):

Callers 12

convert_to_base64Function · 0.90
is_arrayFunction · 0.85
presentMethod · 0.85
validate_coerceMethod · 0.85
validate_coerceMethod · 0.85
validate_coerceMethod · 0.85
validate_coerceMethod · 0.85
validate_coerceMethod · 0.85
validate_coerceMethod · 0.85
validate_coerceMethod · 0.85
validate_coerceMethod · 0.85
validate_coerceMethod · 0.85

Calls 3

get_moduleFunction · 0.90
is_numpy_convertableFunction · 0.85
arrayMethod · 0.45

Tested by

no test coverage detected