You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you encounter a bug in UrbanSim please: 1) first search the previously opened issues to see if the problem has already been reported; 2) If not, fill in the template below and tag with the appropriate Type label. You can delete any sections that do not apply.
Description of the bug
The urbansim/models/transition.py contains the use of np.int, which was originally deprecated in NumPy 1.20, so it cause the problem during the model run.
Data (optional)
If the issue is related to specific data please provide a link to download your data or provide an example dataset that illustrates the issue.
Environment
Operating system:
Mac OSX Ventura
Python version:
3.11
UrbanSim version:
3.2
UrbanSim required packages versions (optional):
Paste the code that reproduces the issue here:
defadd_rows(data, nrows, starting_index=None, accounting_column=None):
""" Add rows to data table according to a given nrows. New rows will have their IDs set to NaN. Parameters ---------- data : pandas.DataFrame nrows : int Number of rows to add. starting_index : int, optional The starting index from which to calculate indexes for the new rows. If not given the max + 1 of the index of `data` will be used. accounting_column: string, optional Name of column with accounting totals/quanties to apply towards the control. If not provided then row counts will be used for accounting. Returns ------- updated : pandas.DataFrame Table with rows added. New rows will have their index values set to NaN. added : pandas.Index New indexes of the rows that were added. copied : pandas.Index Indexes of rows that were copied. A row copied multiple times will have multiple entries. """logger.debug('start: adding {} rows in transition model'.format(nrows))
ifnrows==0:
returndata, _empty_index(), _empty_index()
ifnotstarting_index:
starting_index=data.index.values.max() +1new_rows=sample_rows(nrows, data, accounting_column=accounting_column)
copied_index=new_rows.indexadded_index=pd.Index(np.arange(
starting_index, starting_index+len(new_rows.index), dtype=np.int))
new_rows.index=added_indexlogger.debug(
'finish: added {} rows in transition model'.format(len(new_rows)))
returnpd.concat([data, new_rows]), added_index, copied_index# place code here
Paste the error message (if applicable):
File"/Users/wangweihan/Desktop/Straford_Project/Stratford_urbansim/fast_api/app/urbansim_model/run_model.py", line27, inrun_modelorca.run([
File"/Users/wangweihan/Library/Caches/pypoetry/virtualenvs/stratford-urbansim-api-lZAW07Ha-py3.11/lib/python3.11/site-packages/orca/orca.py", line2177, inrunstep()
File"/Users/wangweihan/Library/Caches/pypoetry/virtualenvs/stratford-urbansim-api-lZAW07Ha-py3.11/lib/python3.11/site-packages/orca/orca.py", line973, in__call__returnself._func(**kwargs)
^^^^^^^^^^^^^^^^^^^^File"/Users/wangweihan/Desktop/Straford_Project/Stratford_urbansim/fast_api/app/urbansim_model/model_config/models.py", line125, inhouseholds_transitionreturnutils.simple_transition(households, .05, "building_id")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/Users/wangweihan/Desktop/Straford_Project/Stratford_urbansim/fast_api/app/urbansim_model/model_config/utils.py", line159, insimple_transitiondf, added, copied, removed=transition.transition(df, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/Users/wangweihan/Library/Caches/pypoetry/virtualenvs/stratford-urbansim-api-lZAW07Ha-py3.11/lib/python3.11/site-packages/urbansim/models/transition.py", line201, intransitionreturnadd_or_remove_rows(data, nrows, accounting_column=self.accounting_column)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/Users/wangweihan/Library/Caches/pypoetry/virtualenvs/stratford-urbansim-api-lZAW07Ha-py3.11/lib/python3.11/site-packages/urbansim/models/transition.py", line136, inadd_or_remove_rowsupdated, added, copied=add_rows(
^^^^^^^^^File"/Users/wangweihan/Library/Caches/pypoetry/virtualenvs/stratford-urbansim-api-lZAW07Ha-py3.11/lib/python3.11/site-packages/urbansim/models/transition.py", line63, inadd_rowsstarting_index, starting_index+len(new_rows.index), dtype=np.int))
^^^^^^File"/Users/wangweihan/Library/Caches/pypoetry/virtualenvs/stratford-urbansim-api-lZAW07Ha-py3.11/lib/python3.11/site-packages/numpy/__init__.py", line305, in__getattr__raiseAttributeError(__former_attrs__[attr])
AttributeError: module'numpy'hasnoattribute'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` tospecifytheprecision. Ifyouwishtoreviewyourcurrentuse, checkthereleasenotelinkforadditionalinformation.
ThealiaseswasoriginallydeprecatedinNumPy1.20; formoredetailsandguidanceseetheoriginalreleasenoteat:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations# place error message here
The text was updated successfully, but these errors were encountered:
If you encounter a bug in UrbanSim please: 1) first search the previously opened issues to see if the problem has already been reported; 2) If not, fill in the template below and tag with the appropriate
Type
label. You can delete any sections that do not apply.Description of the bug
The urbansim/models/transition.py contains the use of np.int, which was originally deprecated in NumPy 1.20, so it cause the problem during the model run.
Data (optional)
If the issue is related to specific data please provide a link to download your data or provide an example dataset that illustrates the issue.
Environment
Mac OSX Ventura
3.11
3.2
Paste the code that reproduces the issue here:
Paste the error message (if applicable):
The text was updated successfully, but these errors were encountered: