Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions arithmetics-design/convention.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ conflict, which is the [#295] bug. The caller resolves it explicitly with
`.drop_vars(name)` (remove the coord) or `.assign_coords(name=...)`
(relabel one side).

A common source is a *scalar* coordinate left behind by positional indexing:
`x.isel(time=0)` drops `time` as a dimension but keeps it as a scalar coord
(the first label), so a cyclic/boundary constraint like
`x.isel(time=0) == x.isel(time=-1)` conflicts on `time` (first vs last). Drop
it at the source with `.isel(..., drop=True)` / `.sel(..., drop=True)`.

**Stacked MultiIndex dimensions.** A stacked MultiIndex dim (e.g. PyPSA's
`(period, timestep)` `snapshot`) stores its *levels* as auxiliary
coordinates — `period` and `timestep` are non-dimension coords on
Expand Down
10 changes: 7 additions & 3 deletions doc/migrating-to-v1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,14 @@ Every row is a legacy guess that becomes an explicit rule under v1. The
- Absence propagates (the slot stays absent) instead of counting as ``0``.
- Decide the intent: ``.fillna(0)`` to keep the old "treat as zero", or
leave it to propagate and drop the term.
* - **Conflicting auxiliary coordinates** on a shared dim
* - **Conflicting auxiliary coordinates** on a shared dim — including a
leftover *scalar* coord from positional indexing (``x.isel(time=0)``
keeps ``time`` as a scalar coord, so a cyclic/boundary constraint like
``x.isel(time=0) == x.isel(time=-1)`` sees ``time`` = first vs last)
- Raises instead of silently dropping one.
- ``.drop_vars(name)`` to remove the coord, or ``.assign_coords(name=...)``
to relabel one side.
- ``.drop_vars(name)`` / ``.assign_coords(name=...)``; for a leftover index
coord, drop it at the source with ``.isel(..., drop=True)`` /
``.sel(..., drop=True)``.
* - A first-class ``pd.MultiIndex`` **dimension** — and a per-*level* input
onto it (e.g. per-``period`` bounds onto a ``(period, timestep)``
``snapshot``)
Expand Down