Plot fails with `NoneType object not callable` for plotly backend in pandas
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 18.8k
- Fork
- 2.8k
- Merge trung bình
- 16 giờ 26 phút
- Pull request đã merge (30 ngày)
- 21
Mô tả
Thanks for your interest in Plotly.py!
Before opening an issue, please search for existing and closed issues :)
Please accompany bug reports with a reproducible example. Please use the latest version of plotly.py in your report unless not applicable.
When plotting a DataFrame with pandas and the plotly backend this fails only in debug mode with the following error:
Traceback (most recent call last):
File "/Users/patrick/mambaforge/envs/random/lib/python3.10/site-packages/numpy/core/getlimits.py", line 650, in __init__
self.dtype = numeric.dtype(int_type)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/patrick/mambaforge/envs/random/lib/python3.10/site-packages/plotly/express/__init__.py", line 15, in <module>
from ._imshow import imshow
File "/Users/patrick/mambaforge/envs/random/lib/python3.10/site-packages/plotly/express/_imshow.py", line 4, in <module>
from .imshow_utils import rescale_intensity, _integer_ranges, _integer_types
File "/Users/patrick/mambaforge/envs/random/lib/python3.10/site-packages/plotly/express/imshow_utils.py", line 21, in <module>
_integer_ranges = {t: (np.iinfo(t).min, np.iinfo(t).max) for t in _integer_types}
File "/Users/patrick/mambaforge/envs/random/lib/python3.10/site-packages/plotly/express/imshow_utils.py", line 21, in <dictcomp>
_integer_ranges = {t: (np.iinfo(t).min, np.iinfo(t).max) for t in _integer_types}
File "/Users/patrick/mambaforge/envs/random/lib/python3.10/site-packages/numpy/core/getlimits.py", line 652, in __init__
self.dtype = numeric.dtype(type(int_type))
TypeError: 'NoneType' object is not callable
# import plotly.express as px
import pandas as pd
pd.options.plotting.backend = "plotly"
df = pd.DataFrame({"a": [1, 2, 3], "b": 100})
fig = df.plot()
fig.write_html(Path("/tmp").joinpath("testplot.html"))
I am using pandas 1.4.3, numpy 1.23.1 and saw this on poorly 5.10 and back to 5.7 (stopped checking then). I suspect that this is similar to https://github.com/numpy/numpy/issues/21008.
The error disappears then importing plotly.express before calling df.plot(). (Importing only plotly is not sufficient).
Could not find anything similar on the issue tracker
Note that GitHub Issues are meant to be used for bug reports and feature requests only. Implementation or usage questions should be asked on community.plotly.com or on Stack Overflow (tagged plotly).
Edit: Sorry for the issue title, auto spelling...
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với bản tái hiện tối thiểu của pandas DataFrame bằng cách sử dụng backend vẽ biểu đồ của plotly và so sánh với trường hợp import plotly.express trước. Kiểm tra đường dẫn traceback trong plotly/express/_imshow.py, plotly/express/imshow_utils.py và numpy/core/getlimits.py. Được xem là hoàn tất khi df.plot() không còn gây ra lỗi NoneType trong chế độ debug mà không yêu cầu import plotly.express trước đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- pandas, python
- Lĩnh vực
- backend, data-visualization
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 58/100