Skip to content

fig.append_trace() raises ValueError if row arg is not type int. #2391

Closed
@mark-datanaltek

Description

@mark-datanaltek

fig.append_trace() raises ValueError if the row arg is not type int, even if arg is int-like:
DEBUG row:1, type(row):<class 'numpy.int64'>

If I explicitly cast to int with row=int(row), all is well. The issue may be due to the isinstance check at line 1536 of basedatatypes.py?

/usr/local/lib/python3.7/site-packages/plotly/basedatatypes.py in _validate_rows_cols(name, n, vals)
1535
1536 if [r for r in vals if not isinstance(r, int)]:
-> 1537 BaseFigure._raise_invalid_rows_cols(name=name, n=n, invalid=vals)
1538 else:
1539 BaseFigure._raise_invalid_rows_cols(name=name, n=n, invalid=vals)

/usr/local/lib/python3.7/site-packages/plotly/basedatatypes.py in _raise_invalid_rows_cols(name, n, invalid)
1524 )
1525
-> 1526 raise ValueError(rows_err_msg)
1527
1528 @staticmethod

ValueError:
If specified, the rows parameter must be a list or tuple of integers
of length 1 (The number of traces being added)

    Received: [1]

I am working with the latest version:

import plotly
plotly.version
'4.6.0'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething brokengood first issuesuitable for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions