Run a Python code in MATLAB 2022b
11 views (last 30 days)
Show older comments
I have installed Pyton 3.8 and installed this library also. I wrote this code
py = py.importlib.import_module('upsetplot');
plot_handel = py.UpSet;
generate_counts=py.generate_samples;
example_counts = generate_counts()
ax_dict = plot_handel(example_counts).plot()
I am getting this error.
example_counts =
sys:1: FutureWarning: is_monotonic is deprecated and will be removed in a future version. Use is_monotonic_increasing instead.
Python Series with properties:
T: [1×1 py.pandas.core.series.Series]
array: [1×1 py.pandas.core.arrays.numpy_.PandasArray]
at: [1×1 py.pandas.core.indexing._AtIndexer]
attrs: [1×1 py.dict]
axes: [1×1 py.list]
dtype: [1×1 py.numpy.dtype[int64]]
dtypes: [1×1 py.numpy.dtype[int64]]
empty: 0
flags: [1×1 py.pandas.core.flags.Flags]
hasnans: 0
iat: [1×1 py.pandas.core.indexing._iAtIndexer]
iloc: [1×1 py.pandas.core.indexing._iLocIndexer]
index: [1×1 py.pandas.core.indexes.multi.MultiIndex]
is_monotonic: 0
is_monotonic_decreasing: 0
is_monotonic_increasing: 0
is_unique: 1
loc: [1×1 py.pandas.core.indexing._LocIndexer]
name: [1×5 py.str]
nbytes: [1×1 py.int]
ndim: [1×1 py.int]
shape: [1×1 py.tuple]
size: [1×1 py.int]
values: [1×1 py.numpy.ndarray]
cat0 cat1 cat2
False False False 56
True 283
True False 1279
True 5882
True False False 24
True 90
True False 429
True 1957
Name: value, dtype: int64
Error using __init__
Python Error: IndexError: list index out of range
Error in _backend_tk>create_with_canvas (line 457)
Error in backend_bases>new_manager (line 1703)
Error in backend_bases>new_figure_manager_given_figure (line 3518)
Error in backend_bases>new_figure_manager (line 3513)
Error in pyplot>new_figure_manager (line 359)
Error in pyplot>figure (line 783)
Error in deprecation>wrapper (line 454)
Error in plotting>plot (line 842)
I tested the code given on the link in Python and it worked. However its not woring in MATLAB. How can I resolve it?
The website says that output example_counts is a pandas.Series with 3-level Multi-index. Does MATALB is changing this thats why its not able to plot?
Thank You.
0 Comments
Answers (0)
See Also
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!