Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

unsupported Python data type: pandas.core.frame.DataFrame #13

Open
Coder786 opened this issue Jun 28, 2022 · 1 comment
Open

unsupported Python data type: pandas.core.frame.DataFrame #13

Coder786 opened this issue Jun 28, 2022 · 1 comment

Comments

@Coder786
Copy link

Coder786 commented Jun 28, 2022

Hi,
When I try to send a dataframe to the df2t function in Python, I get this error message: unsupported Python data type: pandas.core.frame.DataFrame

I'm not sure why this is happening even though I followed all of your steps. Thanks and I hope to hear back soon. @Lenskiy @AlDanial

@Lenskiy
Copy link
Owner

Lenskiy commented Jul 3, 2022

Python and Matlab create two different instances of Pandas classes that are not interchangeable, at least I did not find how to do so.
Here is what works, but unfortunately this is not very helpful:

import matlab.engine 
import pandas

eng = matlab.engine.start_matlab()
eng.addpath(r'Matlab/PythonInterface',nargout=1) # add path to the functions

data = {'Date': ['1/1/2021', '1/2/2021', '1/3/2021', '1/4/2021'], 'Age': [16, 64, 4, 25]}
df = eng.py.pandas.DataFrame(data) # creates DataFrame within Matlab
test_table = eng.df2t(df)
eng.disp(test_table, nargout=0) # Will print out the table

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants