pynwb
pynwb copied to clipboard
[Bug]: FutureWarning from pandas with python 3.14 when running tests
What happened?
When running the pynwb tests with Python 3.14.0rc2+ I get the following warnings:
tests/unit/test_icephys_metadata_tables.py::IntracellularRecordingsTableTests::test_basic_write
tests/unit/test_icephys_metadata_tables.py::IntracellularRecordingsTableTests::test_basic_write
/home/thomas/.venvs/ipfx-3.14-dev/lib/python3.14/site-packages/pynwb/icephys.py:749: FutureWarning: ChainedAssignmentError: behaviour will change in pandas 3.0!
You are setting values through chained assignment. Currently this works in certain cases, but when using Copy-on-Write (which will become the default behaviour in pandas 3.0) this will never work to update the original DataFrame or Series, because the intermediate object on which we are setting values will behave as a copy.
A typical example is when you are setting values in a column of a DataFrame, like:
df["col"][row_indexer] = value
Use `df.loc[row_indexer, "col"] = values` instead, to perform the assignment in a single step and ensure this keeps updating the original `df`.
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
res[('electrodes', 'electrode')] = [e.object_id for e in res[('electrodes', 'electrode')]]
tests/unit/test_icephys_metadata_tables.py::IntracellularRecordingsTableTests::test_basic_write
tests/unit/test_icephys_metadata_tables.py::IntracellularRecordingsTableTests::test_basic_write
/home/thomas/.venvs/ipfx-3.14-dev/lib/python3.14/site-packages/pynwb/icephys.py:751: FutureWarning: ChainedAssignmentError: behaviour will change in pandas 3.0!
You are setting values through chained assignment. Currently this works in certain cases, but when using Copy-on-Write (which will become the default behaviour in pandas 3.0) this will never work to update the original DataFrame or Series, because the intermediate object on which we are setting values will behave as a copy.
A typical example is when you are setting values in a column of a DataFrame, like:
df["col"][row_indexer] = value
Use `df.loc[row_indexer, "col"] = values` instead, to perform the assignment in a single step and ensure this keeps updating the original `df`.
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
res[('stimuli', 'stimulus')] = \
tests/unit/test_icephys_metadata_tables.py::IntracellularRecordingsTableTests::test_basic_write
tests/unit/test_icephys_metadata_tables.py::IntracellularRecordingsTableTests::test_basic_write
/home/thomas/.venvs/ipfx-3.14-dev/lib/python3.14/site-packages/pynwb/icephys.py:756: FutureWarning: ChainedAssignmentError: behaviour will change in pandas 3.0!
You are setting values through chained assignment. Currently this works in certain cases, but when using Copy-on-Write (which will become the default behaviour in pandas 3.0) this will never work to update the original DataFrame or Series, because the intermediate object on which we are setting values will behave as a copy.
A typical example is when you are setting values in a column of a DataFrame, like:
df["col"][row_indexer] = value
Use `df.loc[row_indexer, "col"] = values` instead, to perform the assignment in a single step and ensure this keeps updating the original `df`.
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
res[('responses', 'response')] = \
Steps to Reproduce
pytest tests
Traceback
Operating System
Linux
Python Executable
Python
Python Version
lower version (unsupported)
Package Versions
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
- [x] Have you checked the Contributing document?
- [x] Have you ensured this bug was not already reported?
I could not choose a future not yet supported python version in the issue template, see also https://github.com/NeurodataWithoutBorders/pynwb/pull/2127.
Thanks @t-b. It looks like there is no release date for pandas 3.0 yet, but we'll take a look at this.