rstudio / reticulate

R Interface to Python
https://rstudio.github.io/reticulate
Apache License 2.0
1.66k stars 327 forks source link

Reading in pickle file throws an error #837

Open lusiki opened 4 years ago

lusiki commented 4 years ago

When I try to import pickle file in markdown:

{python} import os import pandas as pd from pathlib import Path

input_data_path = 'D:/path'

IMPORT PREPARED DATA

X_train = pd.read_pickle(os.path.join(Path(input_data_path), 'X_train.pkl')) X_test = pd.read_pickle(os.path.join(Path(input_data_path), 'X_test.pkl')) y_train = pd.read_pickle(os.path.join(Path(input_data_path), 'y_train.pkl')) y_test = pd.read_pickle(os.path.join(Path(input_data_path), 'y_test.pkl')) labeling_info = pd.read_pickle(os.path.join(Path(input_data_path), 'labeling_info.pkl'))

{r} X_train <- py$X_train

it returns an error: Error in py_get_attr_impl(x, name, silent) : AttributeError: 'DataFrame' object has no attribute '_data'

The same code works in python.

kevinushey commented 4 years ago

Can you please provide a reproducible example?