Skip to content

compilation fails with pandas >=2.0 #11

@a4rcvv

Description

@a4rcvv

Describe the bug

Sometimes scmlv fails to compile when I use it with pandas>=2.0.

To Reproduce
Steps to reproduce the behavior:

  1. Prepare a log folder containing negotiations.csv with None in the agreement column (i.e. logs containing broken negotiations).
  2. Run scmlv show -f <log folder>
  3. Parse Error occurs, and the visualizer raises TypeError
# Error of compilation
No tournament found ... reading world info
        Parse Error logs
        Did not find agent_stats
        Did not find product_stats
        Did not find world_stats
        Did not find contracts
        Did not find contract_stats
        Did not find negotiations
        Did not find offers
        Did not find neg_stats
        Did not find breaches
# Error from the visualizer
Traceback (most recent call last):
  File "/Users/a4rcvv/Documents/projects/scml-repro/.venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "/Users/a4rcvv/Documents/projects/scml-repro/.venv/lib/python3.11/site-packages/scml_vis/presenter.py", line 1548, in <module>
    main(folder)
  File "/Users/a4rcvv/Documents/projects/scml-repro/.venv/lib/python3.11/site-packages/scml_vis/presenter.py", line 193, in main
    products["product"].unique(),
    ~~~~~~~~^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

Expected behavior

scmlv can compile log files successfully.

System (please complete the following information):

  • scml-vis version: 0.3.1
  • Python version: 3.11
  • OS: macOS 14.2

Additional context

One of the current workaround is to use pandas<2.0.0.

Pandas treats a string of "None" as NaN in default since 2.0.0(ref: pandas-dev/pandas#50286, https://pandas.pydata.org/docs/dev/whatsnew/v2.0.0.html).

But it seems that scmlv wants to treat "None" as "None" as a string at here. When I use pandas>=2.0, NaN may be provided to this function which causes an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions