[Bug]: Registering an empty AgentSet in Model.sets raises ColumnNotFoundError for "unique_id"
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start with AgentSetRegistry.add in mesa_frames/concrete/agentsetregistry.py, where agentset["unique_id"] is read around line 108, then check _recompute_ids and the empty pl.DataFrame() created in AgentSet.__init__. Reproduce with the snippet in the issue. Done means an empty set can be registered with zero agents, and index and pos work on it, with a regression test added. The maintainer has not yet chosen between restoring a typed empty column and handling its absence, so confirm the approach before writing code.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
📝 Description
Adding an AgentSet that has no agents yet to model.sets (or an
AgentSetRegistry) raises polars ColumnNotFoundError: unable to find column
"unique_id".
This worked before PR #110 ("Generate automatically unique_id"). At that
point an empty AgentSet was created with a unique_id column in its schema.
After #110, an empty AgentSet has no columns, but AgentSetRegistry.add still
reads agentset["unique_id"].
The same missing column also makes _recompute_ids, AgentSet.index and
(when a space is set) AgentSet.pos fail on an empty set.
🔄 Steps to Reproduce
from mesa_frames import AgentSet, Model
class E(AgentSet):
def step(self):
pass
m = Model()
m.sets += E(m)
🎯 Expected Behavior
I expected the empty AgentSet to be registered with zero agents, so that a
set can be declared (for example in Model.init) and populated later. This
worked before #110.
🚨 Actual Behavior
polars.exceptions.ColumnNotFoundError: unable to find column "unique_id";
valid columns: []
🖥️ Python Version
3.13.2
Operating System
Windows 11 (build 10.0.26300)
Relevant Packages
polars 1.36.1
mesa 3.3.1
mesa-frames at main, commit ef92326
📊 Relevant Log Output
Traceback (most recent call last):
File "<string>", line 5, in <module>
m.sets += E(m)
File "mesa_frames/abstract/agentsetregistry.py", line 480, in __iadd__
return self.add(sets=other, inplace=True)
File "mesa_frames/concrete/agentsetregistry.py", line 108, in add
[obj._ids] + [pl.Series(agentset["unique_id"]) for agentset in other_list]
...
polars.exceptions.ColumnNotFoundError: unable to find column "unique_id"; valid columns: []
➕ Additional Context
Before commit e757571 (#110), AgentSet.init created the empty frame with
a unique_id column: pl.DataFrame(schema={"unique_id": pl.Int64}). After it,
it is pl.DataFrame() with no columns, but AgentSetRegistry.add (and
_recompute_ids) still read agentset["unique_id"].
The same missing column also makes AgentSet.index fail on an empty set, and
AgentSet.pos fail when a space is set.
I searched open and closed issues and PRs for "empty", "unique_id" and
"AgentSetRegistry" and did not find this reported.
Question: should empty sets be registrable? If so, would you prefer restoring
a typed empty unique_id column, or handling its absence where it is read? Or
is the current behaviour intended?
I'm happy to send a PR once you say which approach you prefer.
- Lenguaje dominante
- Python
- Estrellas
- 44
- Forks
- 20
- Merge medio
- 1 min
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de mesa/mesa-frames
-
Mesa-frames 0.2.0Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
mesa/mesa-frames#186 · 10 comentarios ·
-
feature triage
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
mesa/mesa-frames#177 · 1 comentario ·
-
[Bug]: Solving polars Deprecation warnings for `is_in`Posiblemente ocupada @adamamer20 la tomó hace 429 días. Abiertobug good first issue maintenance Sprints!
mesa/mesa-frames#174 · 2 comentarios · 1 asignado ·
-
[Enhancement] : agents selection in AgentsDf would be better if it returns agent_idx/name as keyAbiertoenhancement
Dificultad 3/5 1-2 días Aptitud para principiantes 40/100
mesa/mesa-frames#162 · 1 comentario ·
-
[Feature]: Easy seed accessor across the entire codebaseQuizá libre de nuevo @falloficaruss la tomó hace 327 días y no hay ningún pull request abierto. Abiertofeature good first issue Sprints!
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
mesa/mesa-frames#159 · 3 comentarios ·
Todos los issues de mesa/mesa-frames
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
huggingface/smolagents#3106 ·
Los mantenedores suelen responder en 2 días
-
area:scripts area:tests bug priority:later
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Ikalus1988/MisakaNet#4358 ·
Los mantenedores suelen responder en 1 día
-
Discovered ports from service discovery are never propagated to modules in Module.load()Posiblemente ocupada @vishalmore90 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
OWASP/Nettacker#1828 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
aws-samples/sample-per-model-bedrock#708 ·
Los mantenedores suelen responder en 1 día
-
maintenance
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100