Skip to content

[Bug]: FutureWarning from pandas with python 3.14 when running tests #2126

@t-b

Description

@t-b

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

environment_for_issue.txt

Code of Conduct

Metadata

Metadata

Assignees

Labels

category: bugerrors in the code or code behaviorpriority: lowalternative solution already working and/or relevant to only specific user(s)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions