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

Function _to_unix_epoch_seconds

plotly/express/_core.py:170–186  ·  view source on GitHub ↗
(s: nw.Series)

Source from the content-addressed store, hash-verified

168
169
170def _to_unix_epoch_seconds(s: nw.Series) -> nw.Series:
171 dtype = s.dtype
172 if dtype == nw.Date:
173 return s.dt.timestamp("ms") / 1_000
174 if dtype == nw.Datetime:
175 if dtype.time_unit in ("s", "ms"):
176 return s.dt.timestamp("ms") / 1_000
177 elif dtype.time_unit == "us":
178 return s.dt.timestamp("us") / 1_000_000
179 elif dtype.time_unit == "ns":
180 return s.dt.timestamp("ns") / 1_000_000_000
181 else:
182 msg = "Unexpected dtype, please report a bug"
183 raise ValueError(msg)
184 else:
185 msg = f"Expected Date or Datetime, got {dtype}"
186 raise TypeError(msg)
187
188
189def _generate_temporary_column_name(n_bytes, columns) -> str:

Callers 1

make_trace_kwargsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected