Skip to content

Commit

Permalink
fix: capacity can be float to represent np.nan
Browse files Browse the repository at this point in the history
  • Loading branch information
adamamer20 committed Aug 18, 2024
1 parent 8e9a8bf commit 747c36d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mesa_frames/abstract/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,10 +1156,15 @@ def __init__(
index_cols="agent_id",
dtypes={col: int for col in ["agent_id"] + self._pos_col_names},
)

cells_df_dtypes = {col: int for col in self._pos_col_names}
cells_df_dtypes.update(
{"capacity": float} # Capacity can be float if we want to represent np.nan
)
self._cells = self._df_constructor(
columns=self._pos_col_names + ["capacity"],
index_cols=self._pos_col_names,
dtypes={col: int for col in self._pos_col_names + ["capacity"]},
dtypes=cells_df_dtypes,
)
self._offsets = self._compute_offsets(neighborhood_type)
self._cells_capacity = self._generate_empty_grid(dimensions, capacity)
Expand Down

0 comments on commit 747c36d

Please sign in to comment.