Skip to content
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

Issue with scrapbook glue in R ipynb: #90

Open
booysej opened this issue Dec 5, 2022 · 0 comments
Open

Issue with scrapbook glue in R ipynb: #90

booysej opened this issue Dec 5, 2022 · 0 comments

Comments

@booysej
Copy link

booysej commented Dec 5, 2022

Hi,

I am running scrapbook to persist a pandas dataframe from an R ipynb using the code below:
I created an identical python notebook that works, it just seems to break as per below...
Any ideas, i would love to run my R and python notebooks with papermill and
persist the return values with scrapbook

------------- Notebook Using R ipynb kernel and R reticulate to sseemlessly use python ---------

library("reticulate")
use_condaenv("kitchen-nb")
pd <- import("pandas")
py_config()
sb <- import("scrapbook", convert = T)

python: /Users/jacques/opt/anaconda3/envs/kitchen-nb/bin/python
libpython: /Users/jacques/opt/anaconda3/envs/kitchen-nb/lib/libpython3.7m.dylib
pythonhome: /Users/jacques/opt/anaconda3/envs/kitchen-nb:/Users/jacques/opt/anaconda3/envs/kitchen-nb
version: 3.7.0 | packaged by conda-forge | (default, Nov 12 2018, 12:34:36) [Clang 4.0.1 (tags/RELEASE_401/final)]
numpy: /Users/jacques/opt/anaconda3/envs/kitchen-nb/lib/python3.7/site-packages/numpy
numpy_version: 1.21.6
pandas: /Users/jacques/opt/anaconda3/envs/kitchen-nb/lib/python3.7/site-packages/pandas

start <- 1
end <- 10
result <- iris[start:end, ]
result <- r_to_py(result) # will convert R data frame to pandas data frame... 
sb$glue("result", result, encoder <- "pandas")
result

--------- Then later from Python Code I am trying ------------

nb = scrapbook.read_notebook("mnt/wolfstack/notebooks/output-notebook-1-5.ipynb")
nb.scraps

It returns: (nothing)
Scraps()

Jacques

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

No branches or pull requests

1 participant