Skip to content

Python wcon pip incompatibility with latest Python 3 pandas #171

@cheelee

Description

@cheelee

This is probably related to the issue of dependencies and version control raised in #168 .

Attempts to load what should be a well-formed WCON file - https://zenodo.org/record/1034927/files/unc-80%20(e1069)%20nRHO-1%20QT309%20on%20food%20L_2011_11_11__13_12___3___4.wcon.zip fails with the following error:

(env) Arya:test-wcon cheelee$ time python read.py 
Loading file: ../static/example.wcon
Traceback (most recent call last):
  File "read.py", line 3, in <module>
    w1 = WCONWorms.load_from_file('../static/example.wcon')
  File "/Volumes/OpenWorm/repository/git/sandbox/nwb-explorer/env/lib/python3.6/site-packages/wcon/wcon_parser.py", line 605, in load_from_file
    w_current = cls.load(infile, validate_against_schema)
  File "/Volumes/OpenWorm/repository/git/sandbox/nwb-explorer/env/lib/python3.6/site-packages/wcon/wcon_parser.py", line 710, in load
    w._data = parse_data(root['data'])
  File "/Volumes/OpenWorm/repository/git/sandbox/nwb-explorer/env/lib/python3.6/site-packages/wcon/wcon_data.py", line 320, in parse_data
    df_odict = _obtain_time_series_data_frame(data)
  File "/Volumes/OpenWorm/repository/git/sandbox/nwb-explorer/env/lib/python3.6/site-packages/wcon/wcon_data.py", line 405, in _obtain_time_series_data_frame
    cur_df.index.names = 't'
  File "/Volumes/OpenWorm/repository/git/sandbox/nwb-explorer/env/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 1335, in _set_names
    raise ValueError('Names must be a list-like')
ValueError: Names must be a list-like

This appears to be fixed by replacing the offending line cur_df.index.names = 't' with cur_df.index.names = ['t'] but we'd need to figure out if this is the result of deprecation, and if so after which version of pandas.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions