-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fig.append_trace() raises ValueError if row arg is not type int. #2391
Comments
Thank you @mark-datanaltek this is indeed a bug. To reproduce
|
This could be easily fixed by modifying slightly this line of code https://github.com/plotly/plotly.py/blob/master/packages/python/plotly/plotly/basedatatypes.py#L1531
|
Thanks @emmanuelle for tagging this as a good first issue. I'll see if I can give it a try here! |
Ran into an exception with the reproducing example once I got this working:
Here is one that works with a fix in place. Seeing if I can write this into a test before creating a pull request:
|
I have put a pull request up here: #2451 |
@emmanuelle Thanks for the review! Should we link #2451 now that's been approved and merged for this ticket? I wasn't sure how to do that when I made the PR. |
@MCBoarder289 you can write "closes #xx" with the issue number when you start a PR, then the issue will be closed automatically on merging the PR. Closing since this has been closed by #2451. |
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)
I am working with the latest version:
The text was updated successfully, but these errors were encountered: