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

Function invert_label

plotly/express/_core.py:149–158  ·  view source on GitHub ↗

Invert mapping. Find key corresponding to value column in dict args["labels"]. Returns `column` if the value does not exist.

(args, column)

Source from the content-addressed store, hash-verified

147
148
149def invert_label(args, column):
150 """Invert mapping.
151 Find key corresponding to value column in dict args["labels"].
152 Returns `column` if the value does not exist.
153 """
154 reversed_labels = {value: key for (key, value) in args["labels"].items()}
155 try:
156 return reversed_labels[column]
157 except Exception:
158 return column
159
160
161def _is_continuous(df: nw.DataFrame, col_name: str) -> bool:

Callers 1

make_trace_kwargsFunction · 0.85

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected