Questions tagged [reticulate]

Usage questions regarding reticulate R package which provides a comprehensive set of tools for interoperability between Python and R.

Questions on the reticulate R package which provides a comprehensive set of tools for interopability between Python and R. More information on tutorials and API reference can be found on reticulate's website.

486 questions
2
votes
1 answer

R : install matplotlib in the new Rstudio preview version

I loaded the reticulate package, if it matters. In a python script in R, the below commands work. import numpy as np import pandas as pd But this one doesn't import matplotlib.pyplot as plt The console says : ModuleNotFoundError: no module named…
Yeshyyy
  • 669
  • 6
  • 21
2
votes
1 answer

Not able to import python modules in rmarkdown

I'm am trying to import some python modules from my virtualenv that I created, within a Rmarkdown document. I am new to python, so I'll just walk through the steps of my setup. (1) I created a new virtualevn called r-reticulate in the default root…
Rob A
  • 63
  • 5
2
votes
2 answers

How to Convert Pandas DataFrames to R Dataframes using Reticulate in Rmarkdown

I use Rmarkdown with the reticulate package to weave python and R together. However, the process of converting Pandas DataFrames to R Dataframes doesn't appear to work consistently. Here is a reproducible example: --- output:…
John
  • 149
  • 3
  • 14
2
votes
0 answers

How to convert categorical variables in Python to a factor variable in R? (Reticulate)

I'm using reticulate to convert a python saved .pkl into an R dataframe. I see the categorical python type is kept in the R dataframe. I'm guessing R doesn't know how to deal with python categorical variables. How do I convert those into factor…
2
votes
0 answers

Can you use independent R and Python chunks in RMarkdown Kaggle Kernels? (without reticulate syntax, '$' operator)

I'd like to use the R Notebook shorthand described here in an RStudio blog post and here in the RMarkdown Guide which allows independently executable Python and R chunks in R Notebook documents. Is this possible to set up inside of a Kaggle kernel…
dad
  • 1,335
  • 9
  • 28
2
votes
0 answers

Convert nested list sourced using reticulate to data frame

I am using the source_python function from reticulate to import data into my R environment. The resulting nested list looks quite different than the ones created natively in R. I would be glad if anyone could help me convert this list to data frame.…
OzanStats
  • 2,756
  • 1
  • 13
  • 26
2
votes
1 answer

How to run a specific function in Python file via R in Shiny?

I'm using source_python() function to run a Python Script via user interface of R Shiny. Code is running properly and I'm successful in it. But I want to run a function named function2() which is in Task3.py. Can I do this? If yes then how can I do…
Knowledge Seeker
  • 526
  • 7
  • 25
2
votes
2 answers

r reticulate: rename duplicates from converted Python pandas dataframe

I am using the great new r package "reticulate" to merge Python and R to be able to use an API from a data provider (Thomson Reuters Eikon) in R which is only available for Python. I wish to do that as my R abilities are better than my (almost…
sspade
  • 63
  • 6
2
votes
1 answer

python in rmarkdown (reticulate)

I am trying to add a python chunk in a rmarkdown document. I installed package reticulate then here is my document: ```{r, message=FALSE, warning=FALSE, echo = FALSE} library(reticulate) ``` ```{python, echo = FALSE, eval = FALSE} a=1 a #import…
RockScience
  • 17,932
  • 26
  • 89
  • 125
2
votes
1 answer

reticulate does not work with R-Data frame and fit() function from Python (TypeError: 'float' object cannot be interpreted as an integer)

I try to take a R Data Frame and use it with the package 'reticulate'. I couldn't find an answer in the Internet. sorry if this is a basic question. # Sample Data n <- 5000 n_outlier <- .05 * n set.seed(11212) inlier <- mvtnorm::rmvnorm(n, mean =…
Henryk Borzymowski
  • 988
  • 1
  • 10
  • 22
2
votes
2 answers

AttributeError: 'DataFrame' object has no attribute 'dtype'

I enountered Error in py_get_attr_impl(x, name, silent) : AttributeError: 'DataFrame' object has no attribute 'dtype' on calling python code in R using reticulate package in R. The code in python runs correctly. I am not sure from where this…
Jaws
  • 65
  • 2
  • 8
2
votes
2 answers

Importing matplotlib.pyplot in Rstudio using reticulate

I am unable to import matplotlib.pyplot as plt in Rstudio. I tried the solutions already available on SO. Here are my attempts: I installed reticulate package the devtools install…
Naive_Natural2511
  • 687
  • 2
  • 8
  • 20
2
votes
1 answer

Importing arcpy with reticulate

I wish to import the arcpy library in R using reticulate. I tried running this code in R: library(reticulate) use_python("C:/Python27/ArcGIS10.4") arcpy = import("arcpy") This gives me an error: Error in py_module_import(module, convert = convert)…
Andrew Plowright
  • 455
  • 4
  • 11
2
votes
1 answer

RKeras "unknown url type: https" error six.urlretrieve (Python Code From R)

TL;DR :-) fetching https urls is working in both python and R, but not when python code is run from R. While running some code in documentation of package RKeras , I have repeatedly run into the fatal error : "unknown url type: https" The problem…
R.S.
  • 2,093
  • 14
  • 29
2
votes
1 answer

R - Parsing Python NLTK Trees via Reticulate

I am trying to make use of Python's NLTK package from within R using the Reticulate package. For the most part, I have been successful. Now, I would like to perform named entity recognition (i.e. to determine which tokens represent named entities…
Christopher Costello
  • 1,186
  • 2
  • 16
  • 30