Skip to content

Commit d2483b9

Browse files
Not write in passing list when creating an agent with a list
1 parent 9f71b07 commit d2483b9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mesa_frames/concrete/pandas/agentset.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ def add( # noqa : D102
137137
"Length of data must match the number of columns in the AgentSet if being added as a Collection."
138138
)
139139
if len(agents) == len(obj._agents.columns):
140-
# we suppose the first element of the list is unique_id
141-
agents[0] = next(self._ids[self.model])
140+
agents = next(self._ids[self.model]) + agents[1:]
142141
columns = pd.Index(["unique_id"]).append(obj._agents.columns.copy())
143142
new_agents = pd.DataFrame([agents], columns=columns).set_index(
144143
"unique_id", drop=True

0 commit comments

Comments
 (0)